Reputation: 23
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" />
Upvotes: 0
Views: 4429
Reputation: 38
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
Upvotes: 2