wjyboomshakalaka 2016-03-29 13:43 采纳率: 0%
浏览 1699

TabHost中添加选项卡问题

Caused by: java.lang.IllegalArgumentException: you must specify a way to create the tab content是什么原因呢???
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:layout_width="match_parent"
android:layout_height="338dp"
android:scrollbars="vertical"
android:allowUndo="true" />

<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"
    android:layout_weight="1"
    >
    <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="40dp"
            android:layout_gravity="center_horizontal|top"
            android:orientation="horizontal"
            />

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

        </FrameLayout>
    </LinearLayout>
</TabHost>

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTabHost = (TabHost)findViewById(android.R.id.tabhost);
mTabHost.setup();
mTabSpec_1 = mTabHost.newTabSpec("tab1").setIndicator(TAB1, getResources().getDrawable(R.mipmap.ic_launcher));
mTabHost.addTab(mTabSpec_1);
}
}

  • 写回答

1条回答 默认 最新

  • tonitonisilence 2016-03-29 14:20
    关注

    现在都没人用TabHost,多看看新的东西吧,这都多少年前的控件了。

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料