Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.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 如何将图像视图设置为不同的屏幕大小_Android_Android Layout_Android Imageview_Android Xml_Android Imagebutton - Fatal编程技术网

Android 如何将图像视图设置为不同的屏幕大小

Android 如何将图像视图设置为不同的屏幕大小,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

<?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
中有图像吗?