1

ボタンバーに ?android:attr/buttonBarStyle と ?android:attr/buttonBarButtonStyle を使用しています。

これが私のコードです:

    <LinearLayout
        android:id="@+id/label_edit_dialog_buttonbar"
        style="?android:attr/buttonBarStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/label_edit_dialog_name_edittext"
        android:layout_marginTop="8dp"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/label_edit_dialog_save_button"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/save" />

        <Button
            android:id="@+id/label_edit_dialog_cancel_button"
            style="?android:attr/buttonBarButtonStyle"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/cancel" />
    </LinearLayout>

ここに私が得る結果があります:

ここに画像の説明を入力

ボタン バーと他のビューの間に Divider があると思っていましたが、表示されませんでした。AlertDialog を使用しているときに上部の仕切りが表示されます - AlertDialog xml レイアウトを確認したところ、AlertDialog も buttonBarStyle を使用していることがわかりました。誰にもアイデアはありますか?ありがとう!

開発者の設定は次のとおりです: Eclipse + Nexus 4 Simulator + Min API is 14+

4

1 に答える 1

0

ButtonBarStyle は (私の知る限り) 仕切りを提供しません。このような仕切りを作成するには、それらをレイアウトにビューとして追加する必要があります (詳細については、この質問を参照してください)。

于 2014-10-16T18:54:46.117 に答える