现在的位置: 首页 > 综合 > 正文

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

2013年01月06日 ⁄ 综合 ⁄ 共 1126字 ⁄ 字号 评论关闭

 Tabhost默认的布局文件

  1. <TabHost xmlns:android="http://schemas.android.com/apk/res/android"      
  2.         android:id="@android:id/tabhost"    
  3.         android:layout_width="fill_parent"        
  4.         android:layout_height="fill_parent" >    
  5.         <LinearLayout        
  6.             android:orientation="vertical"    
  7.             android:gravity="bottom"    
  8.             android:layout_width="fill_parent"        
  9.             android:layout_height="fill_parent" >    
  10.             <TabWidget        
  11.                 android:id="@android:id/tabs"      
  12.                 android:layout_width="fill_parent"        
  13.                 android:layout_height="wrap_content" />     
  14.              <FrameLayout        
  15.                 android:id="@android:id/tabcontent"    
  16.                 android:layout_width="fill_parent"        
  17.                 android:layout_height="200dip" >   
  18.             </FrameLayout>    
  19.         </LinearLayout>        
  20. </TabHost>     

移到屏幕底部 

  1. TabWidget tabWidget = tabHost.getTabWidget();  
  2.     LinearLayout lLayout = (LinearLayout) tabHost.getChildAt(0);  
  3.     lLayout.removeViewAt(0);  
  4.     lLayout.addView(tabWidget);  

抱歉!评论已关闭.