Java android fit图像填充整个布局

Java android fit图像填充整个布局,java,android,eclipse,Java,Android,Eclipse,我有一个分辨率的图像,以便在我的测试设备上安装整个屏幕。当使用其他屏幕尺寸测试时,图像只适合宽度或高度,并留下空白,因为它总是按比例缩放。如果比例发生变化,我如何将图像设置为适合全屏显示?例如,如果我的设备屏幕为3/4,则图像将在3/4显示器上正确缩放,而与分辨率无关。但是,对于16/9,它不适合全屏显示 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.an

我有一个分辨率的图像,以便在我的测试设备上安装整个屏幕。当使用其他屏幕尺寸测试时,图像只适合宽度或高度,并留下空白,因为它总是按比例缩放。如果比例发生变化,我如何将图像设置为适合全屏显示?例如,如果我的设备屏幕为3/4,则图像将在3/4显示器上正确缩放,而与分辨率无关。但是,对于16/9,它不适合全屏显示

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:background="@color/blueish"
  android:layout_height="fill_parent">
    <ImageView 
        android:src="@drawable/splashandroid" 
        android:id="@+id/imageView1" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content">
        </ImageView>


</LinearLayout>


还尝试将图像布局宽度的内容换行

添加到ImageView中,
android:scaleType=“fitXY”
或者您可以在活动中使用它意味着
imgview.setScaleType(scaleType.FIT\u XY)

你可以试试这个

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:background="@color/blueish"
  android:layout_height="fill_parent">
    <ImageView 
        android:src="@drawable/splashandroid" 
        android:id="@+id/imageView1" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"
        android:scaleType="fitXY"/>

</LinearLayout>


您是否在imageview中尝试了android:scaleType=“fitXY”尝试添加android:scaleType=“fitXY”但是,这不会将imageview的图像集宽度和高度的纵横比保留为填充父对象。