2015-11-09 2 views
0

У меня есть EditText на темном фоне. Мои EditTexts имеют только черный цвет (если не сфокусированы), поэтому не отображаются правильно. Как изменить цвет? Ниже приведен скриншот. ScreenshotИзменить цвет EditText android

+0

дизайн один файл изображения, как это и установить его в качестве bottomdrawable для TextView –

ответ

2

Вашего вопрос о Android теме stuff.Maybe вы должны установить вашу тему colorControlNormal value.Just, как показано ниже:

<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <item name="colorControlNormal">#YOUR COLOR HEER</item> 
</style> 

ссылки here.

0

Попробуйте это,

editText.getBackground().setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP); 
+0

Нет, полный прямоугольник становится белым – Prakhar

+0

Итак, вам нужно изменить цвет линии? Я прав? –

+0

да, цвет линии – Prakhar

0

Вы используете библиотеку AppCompat? Если да, вы можете переопределить атрибуты стиля colorControlNormal, colorControlActivated и colorControlHighlight.

Например:

<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <item name="colorControlNormal">@color/your_color_1</item> 
    <item name="colorControlActivated">@color/your_color_2</item> 
    <item name="colorControlHighlight">@color/your_color_3</item> 
</style> 
0

Try это может быть поможет вам

 <EditText 
      android:textColorHint="@android:color/white" 
      android:id="@+id/username" 
      style="@style/EditUnderBar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@android:color/transparent" 
      android:hint="@string/hint_email" /> 

Добавить это на свой style.xml

<style name="EditUnderBar" parent="android:Widget.Holo.Light.TextView"> 
    <item name="android:drawableBottom">@drawable/under_bar</item> 
    <item name="android:drawablePadding">3dp</item> 
    <item name="android:layout_marginTop">12dp</item> 
    <item name="android:paddingLeft">4dp</item> 
    <item name="android:textColor">@color/white</item> 
    <item name="android:textSize">16sp</item> 
</style> 

Добавить свой Drawable

<?xml version="1.0" encoding="utf-8"?> 
<shape 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle"> 
    <size android:width="1000dp" android:height="1dp" /> 
    <solid 
    android:color="@color/white"/> 
    </shape> 

Если это не работает, то добавьте это также

<!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 

    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="android:textColorPrimary">@color/textColorPrimary</item> 
    <item name="colorControlNormal">@color/iron</item> 
    <item name="colorControlActivated">@color/white</item> 
    <item name="colorControlHighlight">@color/white</item> 
    <item name="android:textColorHint">@color/white</item> 
    <item name="colorAccent">@color/accent</item> 
    <item name="android:windowBackground">@color/white</item> 
</style> 

свою работу для меня

Его может быть помочь you.Good Удача

Смежные вопросы