tabhost相关报错
来源:互联网 发布:阿里云网站上线 编辑:程序博客网 时间:2024/06/05 09:29
1.Your content must have a TabHost whose id attribute is 'android.R.id.tabhost' 解决
2.Attempt to invoke virtual method 'boolean android.view.View.requestFocus()' on a null object referenceandroid:id="@android:id/tabhost"
注意是@android:id,不是平时写的@id
末尾没有写<TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content">
/
tabhost包含两个控件:TabWidget和FrameLayout是平行独立的关系,不是包含,因为是初学,所以不清楚。
<span style="font-family:Times New Roman;font-size:14px;"><TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@android:id/tabhost"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <span style="background-color: rgb(51, 204, 255);"> <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content"/></span> <span style="background-color: rgb(51, 204, 0);"> <FrameLayout</span> android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/tabcontent"> <!-- 定义第一个标签页的内容 --> <LinearLayout android:id="@+id/tab01" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- 定义两个TextView用于显示标签页中的内容 --> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="孙悟空-2011/07/12"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="猪八戒-2011/07/10"/> </LinearLayout> <!-- 定义第二个标签页的内容 --> <LinearLayout android:id="@+id/tab02" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="萨僧-2011/07/11"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="唐僧-2011/07/10"/> </LinearLayout> <!-- 定义第三个标签页的内容 --> <LinearLayout android:id="@+id/tab03" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="孙悟空-2011/07/12"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="萨僧-2011/07/08"/> </LinearLayout> <span style="background-color: rgb(51, 204, 0);"> </FrameLayout></span> </LinearLayout></span>
0 0
- tabhost相关报错
- TabHost报id错
- TabHost相关
- tabHost的相关用法
- TabHost的相关应用
- 项目报错相关
- 报错相关
- Hibernate5相关报错
- OpenCV 相关报错
- ifconfig命令相关报错
- MySQL数据库相关报错
- VS2013相关报错问题
- TabHost requires a TabWidget with id "android:id/tabs" 报错解决办法
- TabHost
- tabhost
- Tabhost
- TabHost
- tabHost
- 一起学Netty(六)之 TCP粘包拆包场景
- JBPM4.4业务流程管理框架详细解读
- Android Studio 常用快捷键
- Linux驱动开发(二)—DMA的使用(一)
- hiho第一周A+B各种语言版本(内容来自hiho)
- tabhost相关报错
- 向良好进军!
- plugin & hook
- find命令
- 对JPA实体关系管理双向关联的一些思考
- Android 开发者的 RxJava 详解 - 作者:扔物线
- 欢迎使用CSDN-markdown编辑器
- hrbustOJ 1787 New Fibonacci Number (矩阵快速幂+欧拉公式降幂)
- Mac os下安装mysql