2010-05-28 21 views
1

我正在切換標籤點擊活動並在此處成功。但是,在我的Activity類的一個我做了以下內容: public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main);}如何在單擊標籤後設置新活動的背景顏色

main.xml中有以下幾點:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 

android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
    android:background="#BDBDBD" 
> 

我只想改變這個佈局的背景和我希望標籤保持原樣。但在main.xml中使用currentandroid:layout_height =「fill_parent」時,我的背景覆蓋了選項卡,這意味着我無法看到選項卡。如果我makeandroid:layout_height =「wrap_content」`我看不到任何改變和標籤仍然是他們。

回答

0

嘗試在主視圖中使用兩個視圖。

例如:

- >的LinearLayout(父)
--->的LinearLayout(含標籤)
--->的LinearLayout(與主要內容)

這樣,你可以設置主要內容窗口背景的XML或使用myListView.setBackgroundColor()