首页
诗词
字典
板报
句子
名言
友答
励志
学校
网站地图
Android
移动开发
Android
Iphone
Windows Mobile
Symbian
BlackBerry
QT开发
Brew
MeeGo
移动平台
移动软件开发
电信IT应用开发
移动应用
当前位置:
首页
>
教程频道
>
移动开发
>
Android
>
【转】在Titanium开发Android运用时实现底部tabbar
2012-06-30
【转】在Titanium开发Android应用时实现底部tabbar??xml version1.0 encodingutf-8?TabHost xmlns:
【转】在Titanium开发Android应用时实现底部tabbar
?
<?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" android:padding="0dp"> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="0dp" android:layout_weight="1"/> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="0"/> </LinearLayout> </TabHost>
然后再重新clean后再次运行,效果如下:
其实这中间的道理很简单,就是用我们的布局文件覆盖了Titanium既存的布局文件,让应用使用我们的布局文件来运行代码。
关于这里为什么一定要命名为titanium_tabgroup.xml,可以参看源代码的TiTabActivity.java74行-77行
?
int layoutResId = getResources().getIdentifier("titanium_tabgroup", "layout", getPackageName());if (layoutResId == 0) {throw new IllegalStateException("titanium_tabgroup layout resource not found. TabGroup cannot be created.");}?
<?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" android:padding="0dp"> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:padding="0dp" android:layout_weight="1"/> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="0"/> </LinearLayout> </TabHost>
大小: 13.2 KB
大小: 61.2 KB
大小: 57.8 KB
查看更多
下一篇
本文网址:
https://www.reader8.net/jiaocheng/20120630/1444244.html
读书人精选
热点排行
Android之联系人处置
Android中Is library配置的功用
前辈:TextView中的URL超链接显示有关问
Android 卡通框架详解
ubuntu下编译opencore出现有关问题
android sdk adt装配的一些经验-又是吐血
求教 map定位信息如何回传给activity
javaeye中的一些美的android博客
Android直接调用系统根本应用
小弟我的android 第11天 - SharedPrefer