【发布时间】:2017-10-29 16:23:32
【问题描述】:
我有一个要求,当用户点击“查看卡片”按钮时,打开一个不覆盖整个屏幕的较小尺寸的活动。
我做了一些研发工作,并找到了实现这一目标的多种选择。
1- 创建一个布局文件,并在您的活动中创建一个自定义对话框,如下所示。
//OnClickListener
Dialog dialog = new Dialog(main.this);
dialog.setContentView(R.layout.maindialog);
dialog.setTitle("This is my custom dialog box");
dialog.setCancelable(true);
//this can have buttons and other stuff
2- 创建Dialog Fragment
3- 创建一个新活动,并在 Manifest 中添加以下行
android:theme="@android:style/Theme.Translucent"
我无法理解哪种方法更好地实现这一目标。
【问题讨论】:
标签: android performance android-layout android-fragments