如何解决为什么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的布局工具会显示以下内容:
这看起来像是普通图像。该图像在设备上显示正常,但其父设备溢出。我也不明白,但是我可以肯定地说,如果我能先说服Android Studio显示图片,就可以解决溢出问题。
解决方法
您在屏幕截图的左上角看到了那些蓝色框吗?点击那些。您将看到选项“设计”,“蓝图”和“设计+蓝图”。您选择了“蓝图”,但是想要“设计”。切换可以让您获得:
A,预览不会在这里溢出,因此我必须以其他方式解决我的问题。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。