0

Мой редактировать текст теперь выглядит следующим образом (как его фон) http://prntscr.com/843323пользовательского редактирования текст с другой точкой зрения на различных состояниях в андроиде

и это код

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

<item> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle"> 
     <solid android:color="@android:color/transparent" /> 
    </shape> 
</item> 
</selector> 

Как я могу установить подчеркивания для этого редактирования текста (например, белый), когда я нажимаю на него, чтобы написать что-то .. http://prntscr.com/8434s7

ответ

3

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

how to change focus color of EditText in Android

Или Это:

<style name="Theme.MyTheme.EditText" parent="AppTheme"> 
    <item name="colorControlNormal">#ff6600</item> 
    <item name="colorControlActivated">#ff6600</item> 
</style> 


<EditText 
     style="@style/TextAppearance.AppCompat.Display1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/materialDesignEditText" 
     android:ems="10" 
     android:hint="Normal EditText" 
     android:padding="5dp" 
     android:singleLine="true" 
     android:textColor="#000000" 
     android:textColorHint="@android:color/secondary_text_dark" 
     android:textSize="15dp" 
     android:theme="@style/Theme.MyTheme.EditText" /> 
+0

это было не то, что я думал, но это было полезно .. – djumerko

0

Создать textfield_default

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle"> 
    <gradient 
     android:startColor="Color Hash Code" 
     android:endColor="@color/background_material_light" 
     android:angle="90" /> 
</shape> 

создают edit_text.xml в вытяжке

<item 
     android:state_window_focused="false" 
     android:state_enabled="false" 
     android:drawable="@drawable/textfield_disabled" /> 

    <item 
     android:state_pressed="true" 
     android:drawable="@drawable/textfield_pressed" /> 

    <item 
     android:state_enabled="true" 
     android:state_focused="true" 
     android:drawable="@drawable/textfield_selected" /> 

    <item 
     android:state_enabled="true" 
     android:drawable="@drawable/textfield_default" /> 

    <item 
     android:state_focused="true" 
     android:drawable="@drawable/textfield_disabled_selected" /> 

    <item 
     android:drawable="@drawable/textfield_disabled" /> 

</selector> 

<EditText 
     style="@drawable/edit_text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/materialDesignEditText" 
     android:ems="10" 
     android:hint="Text here" 
     android:padding="5dp" 
     android:singleLine="true" 
     android:textColor="#000000" 
     android:textColorHint="@android:color/secondary_text_dark" 
     android:textSize="15dp" />