[英]Java Android Studio: Image View not loading from Drawable folder
I've been working on a simple java application, and wanted to add a logo as the homescreen is fairly empty. 我一直在开发一个简单的Java应用程序,并希望添加徽标,因为主屏幕相当空白。 I tried using an image view, and after it didn't work I googled tutorials to make sure I was initiating it correctly. 我尝试使用图像视图,但在该视图不起作用后,我在教程中搜索以确保我正确启动了它。 I didn't see any difference, but the actual image wouldn't load. 我没有看到任何区别,但实际图像无法加载。
Xml code for image view: 图像视图的XML代码:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src = "@drawable/logo"
android:layout_gravity="center"
android:contentDescription="@string/logo"
android:layout_below="@+id/textView"
android:layout_above="@+id/txtBody"
android:layout_alignRight="@+id/txtBody"
android:layout_alignEnd="@+id/txtBody"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="visible"
android:maxHeight="600dp"
android:maxWidth="600dp"
android:minHeight="100dp"
android:minWidth="100dp"
android:clickable="false" />
And here's a picture of the layout preview (With an arrow pointing to the outline of where it should be, and the resource circled in the correct folder) along with a picture of the logo 这是布局预览的图片(箭头指向应该放置的轮廓,资源在正确的文件夹中圈出)以及徽标的图片
Any dice if you add 任何骰子,如果您添加
android:scaleType="fitCenter"
android:adjustViewBounds="true"
Edit: also are we sure nothing is overlapping it? 编辑:我们也确定没有什么重叠吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.