微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决为什么ImageView在Android Studio中显示通用图像而不是在设备上正常显示的请求图像?

相关的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的布局工具会显示以下内容

generic image

为什么Android Studio中无法显示正确的图像?

这看起来像是普通图像。该图像在设备上显示正常,但其父设备溢出。我也不明白,但是我可以肯定地说,如果我能先说服Android Studio显示图片,就可以解决溢出问题。

解决方法

您在屏幕截图的左上角看到了那些蓝色框吗?点击那些。您将看到选项“设计”,“蓝图”和“设计+蓝图”。您选择了“蓝图”,但是想要“设计”。切换可以让您获得:

enter image description here

A,预览不会在这里溢出,因此我必须以其他方式解决我的问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?