Android 单击选项卡后如何设置新活动的背景色
我在点击标签时切换活动,并在这方面取得了成功。但是,在我的一个活动课上,我做了以下几点:Android 单击选项卡后如何设置新活动的背景色,android,tabs,Android,Tabs,我在点击标签时切换活动,并在这方面取得了成功。但是,在我的一个活动课上,我做了以下几点: public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); } <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
<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">
</LinearLayout>
main.xml具有以下功能:
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
<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">
</LinearLayout>
screen1.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#c6c3c6"
android:layout_gravity="bottom"
android:paddingTop="1dip"
android:paddingLeft="1dip"
android:paddingRight="1dip">
<TabWidget
android:layout_gravity="bottom"
android:id="@android:id/tabs"
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
</FrameLayout>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</FrameLayout>
</TabHost>
Screen2.java
public class OnstarScreen2 extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.screen2);
}
现在,每当我单击screen2选项卡并尝试获取screen2.xml时,我的选项卡都位于screen2布局的下方。我不知道该怎么办。基本上,我想要实现的是,无论上面显示的是什么视图,选项卡都应该始终位于其底部。它们不应与任何其他内容重叠
screen2.xml有一个滚动视图,我认为我有一个线性布局,它有一个登录表单…但是每当调用此表单时,它都会出现在选项卡上方…请帮助您的选项卡有问题。单击选项卡时,您是否正在启动新活动?然后,如果新活动的布局覆盖了整个屏幕,当然选项卡也会被覆盖 请遵循以下指南:
现在,如果我想用我的一个选项卡启动一个网络视图,并且我希望选项卡内容仍然可见,那么我该怎么办呢..因为如果不将布局高度和重量指定为填充父项,我就无法使网络视图正常工作..我有点困惑..请遵循我发布的链接。你提供的信息有限,我帮不了你