質問

これは私のlinearlayout(水平)行がどのように見えるものです:

Enter Image説明

チェックボックスのテキストを1行にする必要があります。ボタンはそれほど広くなる必要はありません。私のXMLには

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <CheckBox
        android:id="@+id/ckbxAllow_New_Items"
        android:layout_width="0dip"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:checked="true"
        android:text="@string/checkbox_Allow_New_Items" />

    <Button
        android:id="@+id/btnOK"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/button_OK" />

    <Button
        android:id="@+id/btnCancel"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/button_Cancel" />

</LinearLayout>
.

...私のチェックボックスのテキストを折り返さないようにするために変更する必要がありますか?

更新

これを追加したDer Golemの提案:

android:lines="1"
.

...またチェックボックスのlayout_weightの変更も1から2の(ボタンに1に設定)を与えてくれたものを教えてください:

画像の記述ここで

役に立ちましたか?

解決

チェックボックスは、 textview から継承するボタンから継承するChindsButtonを継承します。だから、それはこれらの祖先のすべてのプロパティ、メソッドと属性を持っています...
リファレンス:> http://developer.android.com/reference/android/widget/checkbox. .html

特に、 TextView プロパティ、メソッド、属性に興味があります。 参照:> http://developer.android.com/reference/android/widget/textview. .html

特に、android:lines属性に興味があり、 1 に設定します。
これはあなたのチェックボックスに正確に 1行目になるように述べています。

android:ellipsize属性をある値に設定することもできます(i.e:3= end)。
これにより、最後に3つのドット(省略記号)を追加して、切り捨てられたテキストの最後、Start、Center、...に追加するように指示します。

[編集]

TextViewの洞察者であることは、Commentの@CrandellWSのおかげで、setSingleLineを使用できます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top