Android can';设置对话框大小
我的Android can';设置对话框大小,android,xml,size,android-alertdialog,Android,Xml,Size,Android Alertdialog,我的alertdialog有一个固定的最大尺寸,它是一个完美的正方形,边长为min(父宽度、父高度)。这就产生了一个问题,我无法将警报对话框设置为宽屏幕 在对话框中,我加载了一个imageview以显示图像。我希望这张图片能在大屏幕上显示,而不是在一个正方形中,这会使它变小 活动中的警报对话框的代码: AlertDialog.Builder alertadd = new AlertDialog.Builder(MainActivity.this); LayoutInflater factory
alertdialog
有一个固定的最大尺寸,它是一个完美的正方形,边长为min(父宽度、父高度)
。这就产生了一个问题,我无法将警报对话框
设置为宽屏幕
在对话框中,我加载了一个imageview
以显示图像。我希望这张图片能在大屏幕上显示,而不是在一个正方形中,这会使它变小
活动中的警报对话框
的代码:
AlertDialog.Builder alertadd = new AlertDialog.Builder(MainActivity.this);
LayoutInflater factory = LayoutInflater.from(MainActivity.this);
final View view = factory.inflate(R.layout.schematic_image_view, null);
alertadd.setView(view);
alertadd.show();
xml文件的代码schematic\u image\u view.xml
:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_root"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="0dp">
<ImageView
android:id="@+id/schematic"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/schematic">
</ImageView>