我正在编写一个简单的输入法编辑器,但对更改实际键的颜色有些犹豫。这是我的keyboardView位于res/layout
:
<?xml version="1.0" encoding="utf-8"?>
<android.inputmethodservice.KeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/keyboard"
android:keyBackground="@drawable/key_background"
android:keyPreviewLayout="@layout/preview">
</android.inputmethodservice.KeyboardView>
我的key_background:
<item
android:state_focused="false"
android:state_selected="false"
android:state_pressed="false"
android:drawable="@drawable/normal"
/>
<item
android:state_pressed="true"
android:drawable="@drawable/pressed"
/>
,正常状态
<item android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
</shape>
</item>
和按下状态
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/keyboard_pressed"/>
</shape>
因此,我坚持将实际符号(即a,b,c等)的颜色更改为黑色。请参阅所附的屏幕截图,了解我到目前为止获得的内容。
先感谢您。
android:keyTextColor
您可以将此属性添加到KeyboardView
键中标签使用的颜色。
可以是颜色值,形式为“ #rgb”,“#argb”,“#rrggbb”或“ #aarrggbb”。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句