Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.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 studio 为什么ImageView在Android Studio中显示通用图像,而不是在设备上工作的请求图像?_Android Studio_Imageview - Fatal编程技术网

Android studio 为什么ImageView在Android Studio中显示通用图像,而不是在设备上工作的请求图像?

Android studio 为什么ImageView在Android Studio中显示通用图像,而不是在设备上工作的请求图像?,android-studio,imageview,Android Studio,Imageview,相关的xml代码: <LinearLayout android:layout_width="409dp" android:layout_height="579dp" android:orientation="vertical" app:layout_constraintTop_toBottomOf="@+id/title_top"

相关的xml代码:

    <LinearLayout
        android:layout_width="409dp"
        android:layout_height="579dp"
        android:orientation="vertical"
        app:layout_constraintTop_toBottomOf="@+id/title_top"
        app:layout_constraintBottom_toTopOf="@id/title_bottom"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        android:gravity="center_horizontal"
        tools:layout_editor_absoluteX="1dp">

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_constraintBottom_toTopOf="parent"
            app:layout_constraintTop_toBottomOf="parent"
            android:src="@drawable/elenas_shepherd"
            app:layout_constraintLeft_toLeftOf="parent"
            android:contentDescription="@string/splash_description"
            />

    </LinearLayout>

(我只包括了内部布局和ImageView;如果需要,我可以包括更多。)

“elenas_shepherd”的图像看起来像一个牧羊人。然而,Android Studio的布局工具显示了以下内容:

为什么Android Studio中没有显示正确的图像?


这看起来像一个普通的图像。图像在设备上显示良好,但溢出其父设备。我也不明白这一点,但我有理由相信,如果我能首先说服Android Studio显示该图像,我可以修复溢出问题。

你看到截图左上角的蓝色框了吗?点击那些。您将看到选项“设计”、“蓝图”和“设计+蓝图”。您选择了“蓝图”,但您想要“设计”。切换会得到以下结果:


唉,这里的预览没有溢出,所以我必须用另一种方式来解决我的问题。

PS溢出的问题是由于父布局不考虑
match\u parent
。有关详细信息,请参阅。它不会显示在布局编辑器中,因为虚拟设备的尺寸足以以全分辨率显示图像;实际设备的尺寸太小。