【发布时间】:2017-12-03 21:45:02
【问题描述】:
我正在尝试使用自定义视图布局创建一个警报对话框,但屏幕只是变暗,没有出现任何对话框。
AlertDialog.Builder builder = new AlertDialog.Builder(MyActivity.this);
builder.setView(findViewById(R.id.system_profile_dialog));
AlertDialog setSysProfileDialog = builder.create();
setSysProfileDialog.show();
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/system_profile_dialog"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:hint="@string/system_profile_hint"
android:inputType="number" />
</LinearLayout>
【问题讨论】:
标签: java android android-studio dialog android-alertdialog