TabHost 默认布局,以及将TAB移到屏幕底部, 代码实现

来源:互联网 发布:mysql 查看存储引擎 编辑:程序博客网 时间:2024/05/22 15:38
 Tabhost默认的布局文件
<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:gravity="bottom"      android:layout_width="fill_parent"          android:layout_height="fill_parent" >      <TabWidget          android:id="@android:id/tabs"        android:layout_width="fill_parent"          android:layout_height="wrap_content" />        <FrameLayout          android:id="@android:id/tabcontent"      android:layout_width="fill_parent"          android:layout_height="200dip" >     </FrameLayout>  </LinearLayout>      </TabHost>   

移到屏幕底部 

TabWidget tabWidget = tabHost.getTabWidget();LinearLayout lLayout = (LinearLayout) tabHost.getChildAt(0);lLayout.removeViewAt(0);lLayout.addView(tabWidget);