如何制作点击按钮后显示的对话框(如图所示)?该对话框应出现在屏幕底部,其宽度应与屏幕宽度相匹配。
最佳答案
在 xml 中使用 onClick 来处理按钮点击。你可以这样写xml
<Button
android:onClick = dialogShow() />
比你的 Activity 写函数为
public void dialogShow(){
//call next activity or whatever you like to do during button click
}
您可以使用布局将对话框定位到屏幕的按钮并使用
android:layout_width = "match_parent"
在你的对话框或布局中填充屏幕的宽度
关于java - 如何在屏幕底部显示对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47799101/