For my project i have an a custom EditText view that extends EditText. I am also applying a styling to it.. but it seems when i apply the style the native RECTANGLE showing that the field is focused goes away.. my style looks like this:
<style name="edit_text">
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">#000000</item>
<item name="android:singleLine">true</item>
<item name="android:cursorVisible">true</item>
<item name="android:layout_marginBottom">20dip</item>
<item name="android:background">@drawable/text_view_bg</item>
<item name="android:focusable">true</item>
<item name="android:focusableInTouchMode">true</item>
</style>
<style name="large_edit_text" parent="@style/edit_text">
<item name="android:layout_width">740dip</item>
<item name="android:focusable">true</item>
<item name="android:focusableInTouchMode">true</item>
</style>
this shows the focus rectangle:
<medicalforms.form.FormEditText
android:layout_width="580dp"
android:layout_height="wrap_content"
android:layout_weight="0"
android:focusableInTouchMode="true"
android:focusable="true"
formview:form_id="first_name"
formview:form_action="@string/action_property_change"
/>
and this does not:
<medicalforms.form.FormEditText
style="@style/large_edit_text"
android:layout_weight="0"
android:focusableInTouchMode="true"
android:focusable="true"
formview:form_id="first_name"
formview:form_action="@string/action_property_change"
/>
can someone tell me why? i want to keep the native rectangle cue that the field is focused.. but use my styling
Ah, there it is:
<item name="android:background">@drawable/text_view_bg</item>If that drawable is just a plain image, then you won’t have the focused, pressed or selected states. If you look at the drawable that is used for the default EditText, it’s composed of four (or five?) different images for the states.