0

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" />

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Spiele Trend
  • 23
  • 1
  • 5

1 Answers1

2

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

Community
  • 1
  • 1
Lakshit Anand
  • 38
  • 1
  • 4