This activity doesn't open my images at all however the text still opens. I tried both .png and .jpg. I have also tried @drawable still no result.
Java code
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_images);
}
xml script
<?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"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:text="JUST WORK!!!"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:textAppearance="@style/TextAppearance.AppCompat.Display2"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginEnd="58dp"
android:layout_marginBottom="177dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@mipmap/ic_launcher"
android:layout_above="@+id/textView"
android:layout_centerHorizontal="true"
android:layout_marginBottom="120dp"
android:id="@+id/imageView2" />
</RelativeLayout>
Thank you in advance
Your code looks okay.
Try adding your image in your drawable folder.
And add,
android:src="@drawable/yourimage"
in your ImageView XML components.
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.