不显示来电时,新的活动标签栏 [英] Tab bar not showing when call new activity

查看:143
本文介绍了不显示来电时,新的活动标签栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的code

 View view = getLocalActivityManager().startActivity("main_jobs", 
                        new Intent(context,Job_Description.class)
                        .putExtra("line", str_line).putExtra("limit",str_limit)
                        .putExtra("limit",""+0)
                        .putExtra("Alert", false)
                        .putExtra("str_location", str_loc)
                        .putExtra("str_Descrption",str_descjob)
                        .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
                        .getDecorView();
                                              setContentView(view);

我用这code打开新的活动与标签,但标签栏不显示和
没有任何错误得到
请帮我我们怎么能显示标签栏,打开新的活动

I am using this code to open new activity with tab but tab bar not showing and not any error get please help me how we can show tab bar to open new activity

由于提前

推荐答案

样本实施例:
这里考虑三个选项卡
首先在MainActivity.java

Sample Example : Consider three tabs here First in MainActivity.java

public class MainActivity extends TabActivity {

    private static final String TAB1 = "TAB1";
    private static final String TAB2 = "TAB2";
    private static final String TAB3 = "TAB3";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TabHost tabHost = getTabHost();


        TabSpec tab1 = tabHost.newTabSpec(TAB1);
        tab1.setIndicator(TAB1);
        Intent Intent1 = new Intent(this, Tab1.class);
        tab1.setContent(Intent1);


        TabSpec tab2 = tabHost.newTabSpec(TAB2);
        tab2.setIndicator(TAB2);
        Intent Intent2 = new Intent(this, Tab2.class);
        tab2.setContent(Intent2);


        TabSpec tab3 = tabHost.newTabSpec(TAB3);
        tab3.setIndicator(TAB3);
        Intent Intent3 = new Intent(this, Tab3.class);
        tab1.setContent(Intent3);


        tabHost.addTab(tab1); 
        tabHost.addTab(tab2); 
        tabHost.addTab(tab3); 
    }
}

main.xml中

main.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">
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="64dp" />

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"/>
    </LinearLayout>
</TabHost>

然后三类Tab1.java,Tab2.java和Tab3.java
三和XML文件的类。

Then three classes Tab1.java , Tab2.java and Tab3.java And three xml files to that classes.

尝试一下,说。

这篇关于不显示来电时,新的活动标签栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆