R.id.tabcontent报错的一些问题
来源:互联网 发布:数据库的物理结构 编辑:程序博客网 时间:2024/06/05 23:42
对项目做一些简单的框架搭建仍然是用的以前自己写的布局框架。在使用AndroidStudio的时候发现
android.support.v4.app.FragmentTabHost这个方法除了一些问题。如下:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <FrameLayout android:id="@+id/realtabcontent" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" /> <android.support.v4.app.FragmentTabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bottom_bg" > <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#000000" android:orientation="horizontal" /> </android.support.v4.app.FragmentTabHost> </LinearLayout>
之后在网上找到了一篇博客,问题解决:http://blog.csdn.net/deng0zhaotai/article/details/48295285
这边文章真心难找,在百度的搜索方式不一样,一般是搜索R.id.tabcontent的错误日志,这里是
“fragmenttabhost在新版v4包中”才能搜到这篇文章,我一开始也没想到是新V4包的版本问题,
因为androidstudio是最新下载的,创建项目的时候V4包自动使用最新的,所以我以前使用的V4
包是没这个bug的,而新版中暴露了出来,尝试使用了最新的android.support.design.widget.TabLayout,发现有Bug,当标签栏在底部时,系统会先加载内容页,
而不加载标签页,网上说开一个线程来手动加载标签页,我试了一下还是不行。。。如果有人成功了
麻烦告诉我方法,非常感谢!
这里对上述引用的博客再做一些补充。
博客所说的最后一个代码片段描述如下:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <FrameLayout android:id="@+id/realtabcontent" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" /> <android.support.v4.app.FragmentTabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bottom_bg" > </android.support.v4.app.FragmentTabHost> </LinearLayout>
遮挡的问题,在
<android.support.v4.app.FragmentTabHost ><<android.support.v4.app.FragmentTabHost />
这段代码中少了TabWidget这个控件,添加进去之后,按照其所说自定义了framelayout的id
代码中进行相应的更改,可仍然是不行的,提示“R.id.content XXXXXX”错误,我这里直接用的
倒数第二个代码段:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <android.support.v4.app.FragmentTabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="wrap_content" > <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" /> <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_gravity="bottom" android:background="#B0C4DE" android:orientation="horizontal" android:showDividers="middle" /> </android.support.v4.app.FragmentTabHost> </LinearLayout>
关于这个布局会导致覆盖掉TabWidget控件的问题,我这里在TabWidget所包含既一个标签布局中,
使用了warpcontent,然后将TabWidget控件修改:android:layout_height=”40dp”。一般底部标签
不会有多大,所以这里直接定义了一个比较高的dp值,一般是没什么问题的。如果有完美解决覆盖
问题的请告诉我,谢谢~
- R.id.tabcontent报错的一些问题
- R 报错的问题
- [BUG]Your TabHost must have a TabWidget whose id attribute is ‘android.R.id.tabcontent’
- 5 Your TabHost must have a TabWidget whose id attribute is ‘android.R.id.tabcontent’
- [ERROR]Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabcontent'
- 关于R.layout或R.id下变量报错的解决方法
- R.layout.main R.id.lv莫名报错
- 安卓中@id与@+id的区别与实际应用中的@id报错问题
- 安卓中@id与@+id的区别与实际应用中的@id报错问题
- android R.id找不到资源的问题
- R语言的一些问题
- 终结Android项目的R文件报错问题
- Android Studio的一些报错问题
- 保存时候 id报错 问题
- ViewPager滑动报错id冲突问题
- 【Android】 R.layout.main报错问题
- Android R文件报错问题
- 关于VC资源ID的一些问题
- POJ_1787_Charlie'sChange(多重背包&&记录路径)
- 随堂笔记7.30:数组,四种排序方法-------1
- Mybatis最入门---ResultMaps高级用法(上)
- Excel数据驱动框架实战
- 递归、
- R.id.tabcontent报错的一些问题
- Fortran中常用函数列表
- spring 结合 Redis 例子,简单入门例子
- A
- hdu 4183 Pahom on Water(最大流)
- 栈的压入,弹出序列
- android 按两次返回键强制退出整个APP
- 关于UITextField切换系统键盘和InputView的卡顿的问题
- FFmpeg中的通用知识(一) -- 表达式(Expression Evaluation)