【发布时间】:2013-06-08 16:04:45
【问题描述】:
在输入编辑文本时,蓝线会出现在其下方。我希望它留在那里 w 即使不打结。这是因为我的背景很暗,你看不到那里有一个输入字段。如果有人对如何查看 EditText 输入有其他想法,请告知。 谢谢
【问题讨论】:
标签: android colors background android-edittext
在输入编辑文本时,蓝线会出现在其下方。我希望它留在那里 w 即使不打结。这是因为我的背景很暗,你看不到那里有一个输入字段。如果有人对如何查看 EditText 输入有其他想法,请告知。 谢谢
【问题讨论】:
标签: android colors background android-edittext
转到您的 styles.xml 并简单地输入以下内容
<style name="EditTextTheme" parent="Theme.AppCompat.Light">
<item name="colorControlNormal">@color/YourChoice </item>
</style>
然后在你的布局文件whatever.xml中,将它添加到你的根目录
<LinearLayout
...
android:theme="@style/EditTextTheme">
.
.
<EditText... />
</LinearLayout>
底部应该根据您设置的颜色而改变
【讨论】:
您要查找的drawable 名为textfield_multiline_activated_holo_dark.9.png,可以在...\android-sdk\platforms\android-**\data\res\drawable-*dpi 中找到。将它们全部复制到您的项目中,然后将以下内容添加到您的 xml 布局文件中的 EditText:
android:background="@drawable/textfield_multiline_activated_holo_dark"
并且,如果需要,可以像这样更改那里的文本颜色:
android:textColor="@android:color/white"
【讨论】:
您必须像这样创建一个选择 xml 文件:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/your_drawable>
<item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/your_drawable>
<item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/your_drawable>
<item android:state_enabled="true" android:state_focused="true" android:drawable="@drawable/your_drawable>
<item android:state_enabled="true" android:drawable="@drawable/your_drawable>
<item android:state_focused="true" android:drawable="@drawable/your_drawable>
<item android:drawable="@drawable/your_drawable">
</selector>
然后创建一个styles.xml 文件并插入:
<style name="EditTextLight" parent="android:style/Widget.EditText">
<item name="android:background">@drawable/edit_text_holo_light</item>
<item name="android:textColor">white</item>
</style>
然后像这样设置你的编辑文本:
<EditText
style="@style/EditTextHololight" />
【讨论】: