I have EditText in my XML as
<!-- Inside RelativeLayout -->
<EditText
android:id="@+id/edtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/edtPhone"
android:layout_alignLeft="@id/strut"
android:layout_alignBaseline="@+id/txtLabelEmail"
android:inputType="textEmailAddress"
android:singleLine="true"
android:imeOptions="actionDone"
android:hint="@string/profile_email_hint"
style="@style/listTextValue"
android:background="@drawable/edittext_bg"
android:ellipsize="end" />
Style
<style name="listTextValue" parent="android:Widget.EditText">
<item name="android:textSize">@dimen/listTextSize</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">@color/black</item>
<item name="android:background">@drawable/edittext_bg</item>
<item name="android:focusable">true</item>
<item name="android:focusableInTouchMode">true</item>
<item name="android:singleLine">true</item>
<item name="android:ellipsize">end</item>
</style>
If I remove background attribute from EditText in Layout xml, background image will be disappeared.
If I remove ellipsize attribute from EditText in Layout xml, hint text will be expand to two lines.
As this attribute is available in Style from Eclipse’s suggestion, why don’t they work when put in the style?
Edit: My bad, GUI editor didn’t show the background. It was another screen.
I have another layout XML with the same attributes for EditText, the background was shown correctly.
Difference between the layout would be that the first one was used inside a Fragment while the latter used directly within Activity.
This is really strange :S
I think you should try
android:textAppearance="@style/your_style". It works forTextViewandTextViewis parent ofEditText. I think it should also works.