android 中这种类型的选项菜单是什么?

时间:2021-04-20 16:56:35

标签: android xml android-layout

click to open image

enter image description here

它叫什么以及如何制作。

1 个答案:

答案 0 :(得分:0)

这称为自定义对话框。自定义对话框是通过扩展 Dialog 类并通过以下方式使用您自己的布局来实现的:

class CustomDialog extends Dialog {
    
    // default constructor
    public CustomDialog(Activity activity) { // activity that runs your dialog
        super(activity);
    }
        
    // default onCreate method
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            
        // set your custom dialog layout here
        setContentView(R.layout.custom_dialog_layout);
    
        // your code here
    }
}