Android 单击选项卡后如何设置新活动的背景色
我在点击标签时切换活动,并在这方面取得了成功。但是,在我的一个活动课上,我做了以下几点: public void onCreateBundle savedInstanceState{super.onCreatesavedInstanceState;setContentViewR.layout.main;} main.xml具有以下功能:Android 单击选项卡后如何设置新活动的背景色,android,Android,我在点击标签时切换活动,并在这方面取得了成功。但是,在我的一个活动课上,我做了以下几点: public void onCreateBundle savedInstanceState{super.onCreatesavedInstanceState;setContentViewR.layout.main;} main.xml具有以下功能: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" andr
<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"
>
我只想更改此布局的背景,并希望选项卡保持原样。但是使用当前的android:layout\u height=fill\u parentin main.xml,我的背景会覆盖选项卡,这意味着我无法看到选项卡。如果我使用android:layout\u height=wrap\u content`我看不到任何变化,选项卡仍然是它们的。尝试在主视图中使用两个视图 例如: ->线性布局父对象 -->带制表符的线性布局 -->具有主要内容的线性布局 这样,您可以使用XML或myListView.setBackgroundColor设置主内容窗口的背景