Can anyone tell me why the following code is not working? The Image does not appear at all.
<?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>
First : Check if you have added your image source to your xml layout. If you have added an image in the corresponding activity code , then the image will not appear in your xml layout.
android:adjustViewBounds—If set to true, the attribute adjusts the bounds of the ImageView control to maintain the aspect ratio of the image displayed through it.
In my case, all my fragment's imageViews are not showing when I run my application. The problem is, I extend my "Activity" class from "FragmentActivity". so I just change it "FragmentActivity" to "AppCompatActivity"
maybe this will help someone.
In ImageView there is two options src and srcCompact. Try both of them to find out which is working.
android:src="@drawable/slide_view_4"
and
app:srcCompat="@drawable/slide_view_4"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With