简体   繁体   中英

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. 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:

<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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM