对于我的项目,我有一个扩展EditText的自定义EditText视图。我也正在应用它的样式..但是当我应用该样式时,本地RECTANGLE显示该字段的焦点消失了......我的风格看起来像这样:
<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>
这显示了焦点矩形:
<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"
/>
而这不是:
<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"
/>
有人可以告诉我为什么吗?我想保留字段聚焦的原生矩形提示..但使用我的样式
答案 0 :(得分:1)
啊,它是:<item name="android:background">@drawable/text_view_bg</item>
如果那个drawable只是一个普通的图像,那么你将没有聚焦,按下或选择的状态。如果你看一下用于默认EditText的drawable,它由四个(或五个?)不同的状态图像组成。