我正在开发一个示例应用程序.我能够在按钮点击时显示警告有一些小点和按钮.但现在我想显示一个弹出窗口,其中包含 用户名(标签)和文本字段(编辑字段)和一个按钮.点击button.can我为它制作另一个弹出式xml文件?
public void selfDestruct(View view) {
// Kabloey
Log.d("Naveen", "Test====");
System.out.println("----------------------ghfgjhf-----------------");
AlertDialog alertDialog = new AlertDialog.Builder(SecondActivity.this).create();
alertDialog.setTitle("Reset...");
alertDialog.setMessage("R u sure?");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//here you can add functions
} });
alertDialog.show();
}
Run Code Online (Sandbox Code Playgroud)
<Button
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/self_destruct"
android:onClick="selfDestruct" />
Run Code Online (Sandbox Code Playgroud)