2012-04-27 36 views
0

我想創建一個帶按鈕和文本的線性佈局,但是我需要一個背景ImageView,因此我可以在背景中更改圖像。頂部的控件將是半透明的,所以下面的圖片會顯示出來。如何做到使用Android SDK 2.3或以上如何在背景上佈局按鈕和文本ImageView

感謝

+1

背景ImageView,你可以更詳細地介紹它嗎? – 2012-04-27 07:25:49

+1

[你有什麼嘗試?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – adneal 2012-04-27 07:27:57

回答

2

然後,

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/lila_background" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:padding="5dp" 
    android:background="@drawable/img_background" 
    android:orientation="vertical" 
> 

而當你需要的變化,我認爲它的東西如..

((LinearLayout)findViewById(R.id.lila_background)).setBackgroundDrawableResource(R.drawable.image_name); 
0

喜剛需添加android:background =「@ drawable/addon」到你的佈局xml中