我有一个带有自定义布局的Dialog。我为这个Dialog
创建了一个样式,因为我希望它有圆角,边框和某个背景。我发现看到圆角的唯一方法是创建Dialog
,如下所示:
final Dialog dialog = new Dialog(me, R.style.MyDialog);
在这个Dialog
内,我有TableLayout
(只有2行)和几个按钮。我面临的问题是样式R.style.MyDialog也应用于Dialog的内部视图,因此我的TableLayout及其所有行都有圆角和笔划。有没有办法避免它而不必再将一个样式应用于所有受影响的视图?
我尝试创建一个空样式并将其应用于TableLayout及其行,但它不起作用。
<style name="EmptyStyle" parent="AppTheme"></style>
我在内部视图布局中应用它:
<TableLayout
android:id="@+id/result_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
style="@style/EmptyStyle"
>
<TableRow
style="@style/EmptyStyle">
...
</TableRow>
...
</TableLayout>
此布局已添加到对话框中:
final Dialog dialog = new Dialog(me, R.style.MyDialog);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.resultdialog);
谢谢!