当前位置:网站首页>Live broadcast system code, custom soft keyboard style: three kinds of switching: letters, numbers and punctuation
Live broadcast system code, custom soft keyboard style: three kinds of switching: letters, numbers and punctuation
2022-07-06 00:52:00 【Cloudleopard network technology】
Live broadcast system code , Customize the soft keyboard style : Letter 、 Numbers 、 Three kinds of punctuation switching
Call the soft keyboard when necessary activity_mian.xml Add keyboard control in
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<android.inputmethodservice.KeyboardView
android:id="@+id/keyboard_view"
android:shadowRadius="0.0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:keyPreviewLayout="@layout/key_preview_layout"
android:background="#D6D9DE"
android:keyBackground="@drawable/btn_keyboard_key"
android:keyTextColor="#747474"
android:keyTextSize="36dp"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingLeft="95dp"
android:paddingRight="95dp"
android:visibility="gone"
/>
</RelativeLayout>
1.1
android:keyPreviewLayout="@layout/key_preview_layout" This is the style of pop-up box when long pressing the keyboard , If you don't write , System default , Sometimes the default will not be clear
key_preview_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:textColor="@android:color/white"
android:gravity="center"
android:background="#80929299"/>
1.2
android:keyBackground="@drawable/btn_keyboard_key" Shape of key
btn_keyboard_key.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFFFF"/>
<corners android:topLeftRadius="8dip"
android:topRightRadius="8dip"
android:bottomRightRadius="8dip"
android:bottomLeftRadius="8dip" />
</shape>
2. And then in res New folder under folder , There are three new files , That is, the layout of each keyboard style is qwerty.xml, symbols.xml, punctuate.xml
Alphabetic keyboard -qwerty.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Keyboard android:keyWidth="100dp" android:keyHeight="60dp"
android:horizontalGap="10dp" android:verticalGap="15dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<Row>
<Key android:codes="113" android:keyEdgeFlags="left"
android:keyLabel="q" />
<Key android:codes="119" android:keyLabel="w" />
<Key android:codes="101" android:keyLabel="e" />
<Key android:codes="114" android:keyLabel="r" />
<Key android:codes="116" android:keyLabel="t" />
<Key android:codes="121" android:keyLabel="y" />
<Key android:codes="117" android:keyLabel="u" />
<Key android:codes="105" android:keyLabel="i" />
<Key android:codes="111" android:keyLabel="o" />
<Key android:codes="112" android:keyEdgeFlags="right"
android:keyLabel="p" />
</Row>
<Row>
<Key android:horizontalGap="4.999995%p" android:codes="97"
android:keyEdgeFlags="left" android:keyLabel="a" />
<Key android:codes="115" android:keyLabel="s" />
<Key android:codes="100" android:keyLabel="d" />
<Key android:codes="102" android:keyLabel="f" />
<Key android:codes="103" android:keyLabel="g" />
<Key android:codes="104" android:keyLabel="h" />
<Key android:codes="106" android:keyLabel="j" />
<Key android:codes="107" android:keyLabel="k" />
<Key android:codes="108" android:keyEdgeFlags="right"
android:keyLabel="l" />
</Row>
<Row>
<Key android:keyWidth="110dp" android:codes="-1"
android:keyEdgeFlags="left" android:isModifier="true"
android:horizontalGap="33dp"
android:isSticky="true" android:keyIcon="@drawable/shift" />
<Key android:codes="122" android:keyLabel="z" android:horizontalGap="30dp"/>
<Key android:codes="120" android:keyLabel="x" />
<Key android:codes="99" android:keyLabel="c" />
<Key android:codes="118" android:keyLabel="v" />
<Key android:codes="98" android:keyLabel="b" />
<Key android:codes="110" android:keyLabel="n" />
<Key android:codes="109" android:keyLabel="m" />
<Key android:keyWidth="110dp" android:codes="-5"
android:horizontalGap="30dp"
android:keyEdgeFlags="right" android:isRepeatable="true"
android:keyIcon="@drawable/delete" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:keyWidth="110dp" android:codes="-2" android:horizontalGap="43dp"
android:keyIcon="@drawable/number" />
<Key android:keyWidth="110dp" android:codes="46"
android:keyIcon="@drawable/point" />
<Key android:keyWidth="540dp" android:codes="32"
android:isRepeatable="true" android:keyIcon="@drawable/space" />
<Key android:keyWidth="110dp" android:codes="47"
android:keyIcon="@drawable/gang"/>
<Key android:keyWidth="110dp" android:codes="-3"
android:keyEdgeFlags="right" android:keyIcon="@drawable/complete" />
</Row>
</Keyboard>
The above is the live broadcast system code , Customize the soft keyboard style : Letter 、 Numbers 、 Three kinds of punctuation switching , More content welcome to follow the article
边栏推荐
- 孤勇者
- BiShe - College Student Association Management System Based on SSM
- 新手入门深度学习 | 3-6:优化器optimizers
- 从 1.5 开始搭建一个微服务框架——调用链追踪 traceId
- anconda下载+添加清华+tensorflow 安装+No module named ‘tensorflow‘+KernelRestarter: restart failed,内核重启失败
- Location based mobile terminal network video exploration app system documents + foreign language translation and original text + guidance records (8 weeks) + PPT + review + project source code
- 激动人心,2022开放原子全球开源峰会报名火热开启
- Gartner发布2022-2023年八大网络安全趋势预测,零信任是起点,法规覆盖更广
- esxi的安装和使用
- [groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
猜你喜欢
Folding and sinking sand -- weekly record of ETF
[groovy] XML serialization (use markupbuilder to generate XML data | set XML tag content | set XML tag attributes)
[groovy] JSON serialization (convert class objects to JSON strings | convert using jsonbuilder | convert using jsonoutput | format JSON strings for output)
Arduino hexapod robot
Ubantu check cudnn and CUDA versions
Uniapp development, packaged as H5 and deployed to the server
The growth path of test / development programmers, the problem of thinking about the overall situation
Cannot resolve symbol error
图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
Recoverable fuse characteristic test
随机推荐
MIT博士论文 | 使用神经符号学习的鲁棒可靠智能系统
Cf:c. the third problem
Folding and sinking sand -- weekly record of ETF
Classic CTF topic about FTP protocol
[groovy] compile time metaprogramming (compile time method injection | method injection using buildfromspec, buildfromstring, buildfromcode)
Common API classes and exception systems
Building core knowledge points
毕设-基于SSM高校学生社团管理系统
猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
NLP text processing: lemma [English] [put the deformation of various types of words into one form] [wet- > go; are- > be]
Spark AQE
VSphere implements virtual machine migration
MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
95后CV工程师晒出工资单,狠补了这个,真香...
ubantu 查看cudnn和cuda的版本
cf:C. The Third Problem【关于排列这件事】
Gartner发布2022-2023年八大网络安全趋势预测,零信任是起点,法规覆盖更广
C language programming (Chapter 6 functions)
XML Configuration File
Zhuhai's waste gas treatment scheme was exposed