本文介绍了我正在为Android开发键盘.如何更改按键的文字颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何更改按键的文本颜色?
How to change the text color of the keys?
这是我的键盘布局.
<?xml version="1.0" encoding="UTF-8"?>
<android.inputmethodservice.KeyboardView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:keyBackground="@drawable/key_background"
android:background="@color/keyboard_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:keyPreviewLayout="@layout/preview" />
key_background.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Bottom 2dp Shadow -->
<item android:top="4dp"
android:left="2dp"
android:right="2dp">
<shape android:shape="rectangle" >
<solid android:color="@color/key_shadow" />
<corners android:radius="4dp"/>
</shape>
</item>
<!-- White Top color -->
<item android:bottom="4px"
android:top="4dp"
android:left="2dp"
android:right="2dp">
<shape android:shape="rectangle" >
<solid android:color="@color/white" />
<corners android:radius="4dp" />
</shape>
</item>
</layer-list>
推荐答案
请仔细研究一下,您将对您的问题有所了解. http://developer.android.com/reference/android/inputmethodservice/KeyboardView. html
Please look into this you will get an idea for your problem.http://developer.android.com/reference/android/inputmethodservice/KeyboardView.html
android:keyTextColor="your color code"
这篇关于我正在为Android开发键盘.如何更改按键的文字颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!