首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

【转】在Titanium开发Android运用时实现底部tabbar

2012-06-30 
【转】在Titanium开发Android应用时实现底部tabbar??xml version1.0 encodingutf-8?TabHost xmlns:

【转】在Titanium开发Android应用时实现底部tabbar
?【转】在Titanium开发Android运用时实现底部tabbar【转】在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开发Android运用时实现底部tabbar

    其实这中间的道理很简单,就是用我们的布局文件覆盖了Titanium既存的布局文件,让应用使用我们的布局文件来运行代码。

    关于这里为什么一定要命名为titanium_tabgroup.xml,可以参看源代码的TiTabActivity.java74行-77行


    ?【转】在Titanium开发Android运用时实现底部tabbar【转】在Titanium开发Android运用时实现底部tabbar
      int layoutResId = getResources().getIdentifier("titanium_tabgroup", "layout", getPackageName());if (layoutResId == 0) {throw new IllegalStateException("titanium_tabgroup layout resource not found. TabGroup cannot be created.");}?【转】在Titanium开发Android运用时实现底部tabbar【转】在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="0dp" android:layout_weight="0"/> </LinearLayout> </TabHost>
        大小: 13.2 KB
          【转】在Titanium开发Android运用时实现底部tabbar 大小: 61.2 KB
            【转】在Titanium开发Android运用时实现底部tabbar 大小: 57.8 KB

热点排行