为什么 ImageView 在 Android Studio 中显示通用图像而不是在设备上工作的请求图像?
Why does ImageView show a generic image in Android Studio instead of the requested image, which works on the device?
相关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 显示图像,我就能修复溢出问题。
看到屏幕截图左上角的那些蓝色框了吗?点击那些。您会看到选项“设计”、“蓝图”和“设计 + 蓝图”。您选择了“蓝图”,但您想要“设计”。切换让你得到这个:
唉,这里的预览没有溢出,所以我得换个方式解决我的问题。
相关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 显示图像,我就能修复溢出问题。
看到屏幕截图左上角的那些蓝色框了吗?点击那些。您会看到选项“设计”、“蓝图”和“设计 + 蓝图”。您选择了“蓝图”,但您想要“设计”。切换让你得到这个:
唉,这里的预览没有溢出,所以我得换个方式解决我的问题。