【问题标题】:What is this type of option menu called in android?android中这种类型的选项菜单是什么?
【发布时间】:2021-04-20 16:56:35
【问题描述】:

click to open image

它叫什么以及如何制作它。

【问题讨论】:

  • 这是一个带有自定义视图的警报对话框,

标签: android xml android-layout


【解决方案1】:

这称为自定义对话框。自定义对话框是通过扩展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
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-08-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-26
    • 2016-10-18
    相关资源
    最近更新 更多