zoukankan      html  css  js  c++  java
  • android键盘

    在应用的开发过程中有不少的情况下会用到自定义键盘,例如支付宝的支付密码的输入,以及类似的场景。android系统给开发者们提供了系统键盘,KeyboardView,其实并不复杂,只是有些开发者不知道罢了,在这里记录下,避免以后遗忘。

    在布局文件中是这样写的:

     <android.inputmethodservice.KeyboardView
                android:id="@+id/jcd_keyboard_view"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:focusable="true"
                android:layout_marginTop="48dp"
                android:keyBackground="@drawable/jcd_keybox_bg"
                android:focusableInTouchMode="true"
                android:shadowColor="#f2f2f2"
                android:shadowRadius="0.0"
                android:keyPreviewLayout="@layout/key_preview_layout"
                android:background="#f2f2f2"
                android:keyTextColor="#646464"
                />

    keybackground是按键的背景图片最好是使用.9.png图片,这样会防止按键的背景拉伸变形,keyPreviewLayput是按键后的字母放大显示的界面

    效果图片如下:

    在项目的开发过程中,还会遇到一种自定义的键盘样式,就是数字是随机变化的

    效果图如下:

    最后希望有用到的园友们到我的github中去下载源码:

    https://github.com/reachchen/Androidkeybox

  • 相关阅读:
    typeof用法
    图片上传显示图片
    用Express 创建项目
    Express中使用session
    生成一个node项目
    async同步异步
    async异步流程控制
    nodejs并行无关联
    nodejs串行有关联
    nodejs串行无关联
  • 原文地址:https://www.cnblogs.com/ruichenblogs/p/5577930.html
Copyright © 2011-2022 走看看