2016-12-20 9 views
0

私はアンドロイドスタジオには新しく、実際にイメージビューをバックグラウンドとして設定する方法はわかりません。私はどのように背景としてイメージビューを設定しましたか?

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

+0

このソリューションの多くのリンクがある – Athul

+0

http://stackoverflow.com/questions/16135984/full-screen-background-image-in-an -activity?noredirect = 1&lq = 1 – Athul

答えて

1

あなたは背景として画像を設定するには、画像の表示を追加する必要はありません。あなたは、 android:background="@drawable/background_image" をレイアウトタグに追加することでそれを行うことができます。

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

代替の方法については、この質問を参照してください Full screen background image in an activity

+0

ありがとうございました –