我正在为我的按钮栏使用 ?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>
这是我得到的结果:
我希望在我的按钮栏和其他视图之间看到一个分隔线,但我没有看到。我在使用 AlertDialog 时看到了顶部 Divider - 我检查了 AlertDialog xml 布局,发现 AlertDialog 也使用了 buttonBarStyle。有人有什么想法吗?谢谢!
这是开发设置:Eclipse + Nexus 4 Simulator + Min API is 14+