Android: Tabs at the BOTTOM

后端 未结 10 2035
长发绾君心
长发绾君心 2020-11-22 05:03

I\'ve seen some chatter about this, but nothing definite. Is there a way to put the tabs in a TabWidget to the bottom of the screen? If so, how?

I\'ve tried the fol

10条回答
  •  不思量自难忘°
    2020-11-22 05:12

    Here's the simplest, most robust, and scalable solution to get tabs on the bottom of the screen.

    1. In your vertical LinearLayout, put the FrameLayout above the TabWidget
    2. Set layout_height to wrap_content on both FrameLayout and TabWidget
    3. Set FrameLayout's android:layout_weight="1"
    4. Set TabWidget's android:layout_weight="0" (0 is default, but for emphasis, readability, etc)
    5. Set TabWidget's android:layout_marginBottom="-4dp" (to remove the bottom divider)

    Full code:

    
    
    
        
    
            
    
            
    
        
    
    
    

提交回复
热议问题