开发安卓键盘: 如何更改按键预览的背景图片?
最佳答案
如果您通过扩展 KeyboardView 创建自定义键盘,那么我们可以使用 'android:keyPreviewLayout' 属性为我们的自定义 KeyboardView 设置自定义键预览布局。
例如
<com.example.myApp.MyCustomKeyboardView
android:id="@+id/keyboard_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:keyPreviewLayout="@layout/my_custom_layout" />
其中 my_custom_layout.xml 是您的自定义预览布局,类似于
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80sp"
android:textSize="40sp"
android:textColor="?android:attr/textColorPrimaryInverse"
android:minWidth="32dip"
android:gravity="center"
android:background="@color/black"/>
希望这对您有所帮助!
关于安卓键盘按键预览背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12211615/