更改android软键盘示例设计、按钮和背景图像
我正在通过修改SDK中的android软键盘示例来构建自定义键盘。我想更改按钮和背景的图像,但我不知道这些值存储在哪里。它们存储在哪里,或者如何更改图像或颜色?在onClick方法中,您需要以这种方式更改按钮的图像更改android软键盘示例设计、按钮和背景图像,android,Android,我正在通过修改SDK中的android软键盘示例来构建自定义键盘。我想更改按钮和背景的图像,但我不知道这些值存储在哪里。它们存储在哪里,或者如何更改图像或颜色?在onClick方法中,您需要以这种方式更改按钮的图像 public void onClick(View v) { if(v==buttonName){ buttonName.setBackgroundResource(R.drawable.imageName); } } 可以使用andro
public void onClick(View v) {
if(v==buttonName){
buttonName.setBackgroundResource(R.drawable.imageName);
}
}
可以使用
android:background
在input.xml中更改键盘背景颜色。您需要编辑文件res/xml/qwerty.xml
您可以查看和的文档。最后一个定义了按键上显示的内容(看起来您不能更改背景)。您需要编辑文件 res/layout/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"/>
文档中没有更多的属性。好的,但是在单击按钮图像之前,如何更改按钮图像?它的默认值我尝试将android:background更改为input.xml,但没有成功