[英]Change android softkeyboard sample designs, button and background images
我正在通过修改SDK中的android softkeyboard示例来构建自定义键盘。 我想更改按钮和背景的图像,但是我不知道这些值的存储位置。 它们存储在哪里,或者如何更改图像或仅改变颜色?
在onClick方法中,您需要以这种方式更改Button的图像。
public void onClick(View v) {
if(v==buttonName){
buttonName.setBackgroundResource(R.drawable.imageName);
}
}
可以使用android:background
在input.xml中更改键盘背景颜色
您需要编辑文件
RES /布局/input.xml
示例input.xml可能看起来像这样。
<com.example.keyboard.LatinKeyboardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/keyboard"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@drawable/keyboardbackground"
android:keyBackground="@drawable/samplekeybackground"
android:keyPreviewLayout="@layout/input_key_preview"
android:keyTextcolor="@android:color/black"/>
在KeyboardView文档中可以找到更多的属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.