Android ImageView 不显示图像?

新手上路,请多包涵

谁能告诉我为什么以下代码不起作用?图像根本不出现。

 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"

   <ImageView
          android:src="@drawable/splashscreen"
          android:scaleType="center"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" />

</RelativeLayout>

原文由 comead 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 716
1 个回答

在我的例子中,当我运行我的应用程序时,我所有片段的 imageViews 都没有显示。问题是,我从“ FragmentActivity ”扩展了我的“ Activity ”类。所以我只是将其“ FragmentActivity ”更改为“ AppCompatActivity

也许这会帮助某人。

原文由 bst91 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题