Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/206.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在屏幕上居中显示图像视图?(使用java代码)_Android_Imageview - Fatal编程技术网

Android 如何在屏幕上居中显示图像视图?(使用java代码)

Android 如何在屏幕上居中显示图像视图?(使用java代码),android,imageview,Android,Imageview,atm我用的是这个代码,但这个代码对我不起作用,因为这个代码会拉伸屏幕上的图像,我不想这样,我需要图像使用他的真实尺寸(200x210) 如果不想让imageview拉伸图像,则必须指定缩放类型 splash.setScaleType(ScaleType.CENTER); 使用ImageView的以下属性,如下所示: splash.setAdjustViewBounds(true); 并告诉我它是否有效。如果我使用framelayout,这是否有效?或者我必须删除框架布局? splash.s

atm我用的是这个代码,但这个代码对我不起作用,因为这个代码会拉伸屏幕上的图像,我不想这样,我需要图像使用他的真实尺寸(200x210)


如果不想让imageview拉伸图像,则必须指定缩放类型

splash.setScaleType(ScaleType.CENTER);

使用ImageView的以下属性,如下所示:

splash.setAdjustViewBounds(true);

并告诉我它是否有效。

如果我使用framelayout,这是否有效?或者我必须删除框架布局?
splash.setAdjustViewBounds(true);