首页
诗词
字典
板报
句子
名言
友答
励志
学校
网站地图
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
读书人精选
热点排行
关于扩展EditText的有关问题
openssl移植Android使用及其相关经验分享
android获得Activity为Theme.Dialog Act
你运行的程序意外停止 logcat显示如下
android 上的pnglib,zlib jpeglib 库哪
ubuntu11.04下搭建Android推送服务器
android 编译源码 异常解决2
Android获取所在地城市名二
请教一下Android中VideoView的有关问题
android phoneGap 静态页面中简略的数据