我创建了一个活动,我从我的“主要”活动中的一个片段加载它。在这个新活动中,我放置了一个带有来自我的可绘制目录的图像的 ImageView(我有大约 10 个其他可绘制对象,我在主要活动中以完全相同的方式呈现)。
问题是,虽然在 IDE 中我看到了图像,但它没有在运行时显示(通过模拟器)。- 澄清一下,图像是静态的,因此与其他问题相比有所不同(我不是通过代码加载它)。
关于如何解决它的任何想法?我的预感是它与它是一项新活动的事实有关,但我是 android 开发的新手,所以我不能基于任何知识......
我没有向活动的 java 部分添加任何代码(没有触摸任何“on..”,也没有向这个特定文件添加功能)
PS我尝试清理项目,尝试呈现在主要活动上呈现的图像,并重新启动我能做的任何事情......没有任何帮助:(
我的活动 xml 是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="reducted">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/manageSubscriptionScreenLogo"
android:layout_width="match_parent"
android:layout_height="110dp"
app:srcCompat="@drawable/managesubscription_header" />
</LinearLayout>
</RelativeLayout>
- 我将 ImageView 放在 LinearLayout 之外(并删除它),或者将大小更改为 wrap_content 或 match_parent (我尝试了所有组合)都没有关系,图像不会显示。
以及它在运行时的样子: