keyboard键盘demo

Mac 系统升级到 OS X Yosemite 之后,实现了与 iPhone 的跨平台使用,比如你可以在 Mac 上直接接电话,发短信,浏览手机上的网页等,但是一些社交软件并不能实现该服务。如果收到信息需要回复时,你就不得不拿起手机,在小键盘上回复内容,然后不停地在电脑和手机之间切换。

main.xml

1keyboard这款软件就很好的实现了键盘的跨平台使用,通过蓝牙绑定手机之后,可以直接使用 Mac 键盘在手机上输入内容。另外,1keyboard还提供了快捷键的配置,可以非常方便的在不同设备间切换。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/edit"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <EditText
        android:id="@+id/edit1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:password="true" />

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <android.inputmethodservice.KeyboardView
            android:id="@+id/keyboard_view"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:background="@color/lightblack"
            android:keyBackground="@drawable/btn_keyboard_key" 
            android:keyTextColor="@color/white"
            android:keyPreviewLayout="@layout/key_preview_layout"
            android:visibility="gone" />
    </RelativeLayout>

</LinearLayout>

配对成功

key_preview_layout.xml

当然,这款软件只是跨平台使用了 Mac 键盘,无法操控手机,所以当收到消息时,需要你先打开应用软件,再进行输入操作。

<?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="@color/font_red"
android:gravity="center"
android:background="@color/blue"/>

使用平台:Mac
下载地址:http://www.eyalw.com/1keyboard

qwerty.xml

<?xml version="1.0" encoding="UTF-8"?>
<Keyboard android:keyWidth="10.000002%p" android:keyHeight="@dimen/key_height"
    android:horizontalGap="0.0px" android:verticalGap="0.0px"
    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="14.999998%p" android:codes="-1"
            android:keyEdgeFlags="left" android:isModifier="true"
            android:isSticky="true" android:keyIcon="@drawable/sym_keyboard_shift" />
        <Key android:codes="122" android:keyLabel="z" />
        <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="14.999998%p" android:codes="-5"
            android:keyEdgeFlags="right" android:isRepeatable="true"
            android:keyIcon="@drawable/sym_keyboard_delete" />
    </Row>
    <Row android:rowEdgeFlags="bottom">
        <Key android:keyWidth="20.000004%p" android:codes="-2"
            android:keyLabel="12#" />
        <Key android:keyWidth="14.999998%p" android:codes="44"
            android:keyLabel="," />
        <Key android:keyWidth="29.999996%p" android:codes="32"
            android:isRepeatable="true" android:keyIcon="@drawable/sym_keyboard_space" />
        <Key android:keyWidth="14.999998%p" android:codes="46"
            android:keyLabel="." />
        <Key android:keyWidth="20.000004%p" android:codes="-3"
            android:keyEdgeFlags="right" android:keyLabel="完成" />
    </Row>
</Keyboard>

symbols.xml

<?xml version="1.0" encoding="utf-8"?>
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    android:keyWidth="25%p" android:horizontalGap="0px"
    android:verticalGap="0px" android:keyHeight="@dimen/key_height">
    <Row>
        <Key android:codes="49" android:keyLabel="1" />
        <Key android:codes="50" android:keyLabel="2" />
        <Key android:codes="51" android:keyLabel="3" />
        <Key android:codes="57419" android:keyEdgeFlags="right"
            android:keyIcon="@drawable/sym_keyboard_left" />
    </Row>
    <Row>
        <Key android:codes="52" android:keyLabel="4" />
        <Key android:codes="53" android:keyLabel="5" />
        <Key android:codes="54" android:keyLabel="6" />
        <Key android:codes="57421" android:keyEdgeFlags="right"
            android:keyIcon="@drawable/sym_keyboard_right" />
    </Row>
    <Row>
        <Key android:codes="55" android:keyLabel="7" />
        <Key android:codes="56" android:keyLabel="8" />
        <Key android:codes="57" android:keyLabel="9" />
        <Key android:codes="-3" android:keyHeight="100dip"
            android:keyEdgeFlags="right" android:isRepeatable="true"
            android:keyLabel="完成" />
    </Row>
    <Row>
        <Key android:codes="-2" android:keyLabel="ABC" />
        <Key android:codes="48" android:keyLabel="0" />
        <Key android:codes="-5" android:keyIcon="@drawable/sym_keyboard_delete" />
    </Row>
</Keyboard>

本文由大发快三开奖结果发布于电脑,转载请注明出处:keyboard键盘demo

TAG标签:
Ctrl+D 将本页面保存为书签,全面了解最新资讯,方便快捷。