开发者

How to set the background color of new activity after clicking tabs

I am switching activities on tab clicks and successful at this. But, in one of my Activity class I am doing the following: public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main);}

main.xml has the following:

<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="#BDB开发者_运维技巧DBD"
>

I want to change the background of this layout only and I want tabs to their as it is. But with the currentandroid:layout_height="fill_parent"in main.xml my background is overwriting the tabs which means I am unable to see tabs. and If I makeandroid:layout_height="wrap_content"` I cannot see any change taking and tabs are still their.


Try using two views inside a main view.

For example:

-> LinearLayout (parent)
---> LinearLayout (with tabs)
---> LinearLayout (with main content)

That way you can set the background of the main content window in XML or by using myListView.setBackgroundColor()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜