【发布时间】:2012-08-31 08:32:03
【问题描述】:
开发安卓键盘: 如何更改按键预览的背景图片?
【问题讨论】:
-
也许这篇文章对你有帮助:stackoverflow.com/questions/2979926/…
-
非常感谢,但该帖子适用于关键背景。我想更改关键的 PREVIEW 背景。
标签: android image background keyboard preview
开发安卓键盘: 如何更改按键预览的背景图片?
【问题讨论】:
标签: android image background keyboard preview
如果您通过扩展 KeyboardView 来创建自定义键盘,那么我们可以使用 'android:keyPreviewLayout' attr 为自定义 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"/>
希望这会有所帮助!
【讨论】: