2
In normal textview etc we can ellipsize the text by command:  
android:ellipsize=""

I am customizing the android's soft keyboard. I want to know that is their a way to ellipsize the key of keyboard?

My code is:

<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
    android:horizontalGap="1px"
    android:keyHeight="@dimen/key_height"
    android:keyWidth="10%p"
    android:verticalGap="-5%p" >

    <!-- android:verticalGap="@dimen/verticalGap" > -->

    <Row>
        <Key
            android:codes="555555"
            android:horizontalGap="1.5%p"
            android:isRepeatable="true"
            android:keyEdgeFlags="left"
            android:keyHeight="@dimen/mic_key_height"
            android:keyIcon="@drawable/voice_input"
            android:keyWidth="28.5%p" />
        <Key
            android:codes="111111"
            android:ellipsize="end"
            android:horizontalGap="2%p"
            android:keyEdgeFlags="right"
            android:keyHeight="@dimen/templates_key_height"
            android:keyWidth="67%p" />
    </Row>
    <Row>
        <Key
            android:codes="222222"
            android:ellipsize="end"
            android:horizontalGap="32%p"
            android:keyEdgeFlags="right"
            android:keyHeight="@dimen/templates_key_height"
            android:keyWidth="67%p" />
    </Row>
    <Row>
        <Key
            android:codes="333333"
            android:ellipsize="end"
            android:horizontalGap="32%p"
            android:keyEdgeFlags="right"
            android:keyHeight="@dimen/templates_key_height"
            android:keyWidth="67%p" />
    </Row>
    <Row>
        <Key
            android:codes="777777"
            android:ellipsize="end"
            android:horizontalGap="32%p"
            android:keyEdgeFlags="right"
            android:keyHeight="@dimen/templates_key_height"
            android:keyWidth="67%p" />
    </Row>
    <Row>
        <Key
            android:codes="666666"
            android:horizontalGap="1.5%p"
            android:isModifier="true"
            android:keyEdgeFlags="left"
            android:keyHeight="@dimen/templates_key_height"
            android:keyIcon="@drawable/voice_keyboard_enable"
            android:keyWidth="28.5%p"
            android:verticalGap="1.5%p" />
        <Key
            android:codes="444444"
            android:horizontalGap="1.7%p"
            android:keyEdgeFlags="right"
            android:keyHeight="@dimen/templates_key_height"
            android:keyLabel="@string/more_templates"
            android:keyWidth="67%p"
            android:verticalGap="1%p" />
    </Row>

</Keyboard>

我正在定制安卓的软键盘。我想知道这是他们省略键盘键的一种方法吗?我动态地将文本添加到键中,但文本流出键边界。我想省略密钥。

4

2 回答 2

0

你不能椭圆化,因为它有标签,而不是文本。

于 2012-11-01T11:03:08.500 回答
0

这不是一个简单的方法,但是您可以按照您希望的方式为每个键创建图像,然后您将以下内容放入键盘:

android:keyIcon=""
于 2016-01-15T17:39:00.450 回答