读书人

【转】在Titanium开发Android运用时实

发布时间: 2012-06-30 17:20:12 作者: rapoo

【转】在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

读书人网 >Android

热点推荐