I declare style res / values ​​/ styles.xml

<style name="EditTextTheme" > <item name="android:textCursorDrawable">@null</item> <item name="android:textColor">@color/yellow</item> <item name="android:textColorHint">@color/greyBack</item> <item name="android:background">@color/green</item> <item name="android:textSize">18sp</item> </style> 

I specify this style in EditText:

 <com.group.improve.improvegrouptestproject.ImpGroupEditText android:hint="@string/si_username_edit_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:maxLength="20" android:theme="@style/EditTextTheme" android:id="@+id/si_et_username" android:layout_marginTop="@dimen/top_margin" android:layout_marginRight="@dimen/rigth_margin" android:layout_marginLeft="@dimen/left_margin" /> 

This code works on new versions of Android, on older (for example 4.2.2 Moto X) styles do not work. How to make it work on older versions?

  • one
    Try registering like this: style="@style/EditTextTheme" - Yuriy SPb
  • Yes, it worked thanks. Write it as an answer, I will mark your decision. - Vadimcg

1 answer 1

To work on older versions, you must also prescribe the style as the value of the style attribute:

 style="@style/EditTextTheme"