2012-04-27 39 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中