Android 如何将图像视图设置为不同的屏幕大小
在我的应用程序中,我使用了一个图像视图,我选择了宽度和高度,匹配父对象和填充父对象,但图像仍然小于我的屏幕大小。这个代码有什么问题。我知道这是一个愚蠢的问题,我是安卓新手,我想解决这个问题,有人能给出解决方案吗 我的xmlAndroid 如何将图像视图设置为不同的屏幕大小,android,android-layout,android-imageview,android-xml,android-imagebutton,Android,Android Layout,Android Imageview,Android Xml,Android Imagebutton,在我的应用程序中,我使用了一个图像视图,我选择了宽度和高度,匹配父对象和填充父对象,但图像仍然小于我的屏幕大小。这个代码有什么问题。我知道这是一个愚蠢的问题,我是安卓新手,我想解决这个问题,有人能给出解决方案吗 我的xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientati
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:id="@+id/imageView" />
<Button
android:id="@+id/btnAddExpense"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:text="Skip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
图像视图
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:id="@+id/imageView" />
<Button
android:id="@+id/btnAddExpense"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:text="Skip"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
默认情况下,ImageView控件的内容具有一定的大小——通常是图像尺寸的大小。为了解决这个问题,您需要将
android:adjustViewBounds=“true”
添加到ImageView
和android:scaleType=“fitXY”
我已经添加了它,但问题仍然没有解决。还有其他更改吗?您好,我已经添加了,android:adjustViewBounds=“true”,还有scale type=fitXY,但显示没有更改,问题仍然存在,您可以使用imageview参数,但我非常确定它现在应该已经工作了。也许你需要告诉imageview在按钮上方,但是从那以后,你失去了我。Thanx,我不知道实际的问题是什么,请查看我的编辑你在imageview
中有图像吗?