当前位置:网站首页>直播系统代码,自定义软键盘样式:字母、数字、标点三种切换
直播系统代码,自定义软键盘样式:字母、数字、标点三种切换
2022-07-06 00:51:00 【云豹网络科技】
直播系统代码,自定义软键盘样式:字母、数字、标点三种切换
在需要的调用软键盘的activity_mian.xml中加入键盘控件
<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"这个是长按键盘时弹出框的样式,如果不写,系统默认,默认的有时会会看不清
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"按键的形状
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.然后在res文件夹下新建文件夹,里面新建三个文件,即每种键盘样式的布局分别为qwerty.xml, symbols.xml, punctuate.xml
字母键盘-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>
以上就是直播系统代码,自定义软键盘样式:字母、数字、标点三种切换, 更多内容欢迎关注之后的文章
边栏推荐
- MCU通过UART实现OTA在线升级流程
- 几百行代码实现一个 JSON 解析器
- CTF daily question day44 rot
- Arduino hexapod robot
- Construction plan of Zhuhai food physical and chemical testing laboratory
- Opencv classic 100 questions
- Basic introduction and source code analysis of webrtc threads
- Data analysis thinking analysis methods and business knowledge -- analysis methods (II)
- 毕设-基于SSM高校学生社团管理系统
- 常用API类及异常体系
猜你喜欢
猿桌派第三季开播在即,打开出海浪潮下的开发者新视野
Arduino hexapod robot
XML Configuration File
《强化学习周刊》第52期:Depth-CUPRL、DistSPECTRL & Double Deep Q-Network
Idea远程提交spark任务到yarn集群
Arduino六足机器人
KDD 2022 | EEG AI helps diagnose epilepsy
ubantu 查看cudnn和cuda的版本
Model analysis of establishment time and holding time
Exciting, 2022 open atom global open source summit registration is hot
随机推荐
vSphere实现虚拟机迁移
An understanding of & array names
golang mqtt/stomp/nats/amqp
After Luke zettlemoyer, head of meta AI Seattle research | trillion parameters, will the large model continue to grow?
图解网络:TCP三次握手背后的原理,为啥两次握手不可以?
免费的聊天机器人API
【文件IO的简单实现】
curlpost-php
Comment faire votre propre robot
State mode design procedure: Heroes in the game can rest, defend, attack normally and attack skills according to different physical strength values.
[groovy] JSON string deserialization (use jsonslurper to deserialize JSON strings | construct related classes according to the map set)
Idea remotely submits spark tasks to the yarn cluster
Leetcode Fibonacci sequence
Spark获取DataFrame中列的方式--col,$,column,apply
Common API classes and exception systems
The population logic of the request to read product data on the sap Spartacus home page
China Taiwan strategy - Chapter 8: digital marketing assisted by China Taiwan
devkit入门
CTF daily question day44 rot
I'm interested in watching Tiktok live beyond concert