I´m new to android studio and don`t really know how to set an Imageview as background.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@android:drawable/arrow_up_float"
android:id="@+id/imageViewFull" />
You don't need to add Image view to set image as background. You can do it by adding android:background="@drawable/background_image"
to the layout tag.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:background="@drawable/background_image">
Refer to this question for alternative ways Full screen background image in an activity
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.