Android: Tabs at the BOTTOM

后端 未结 10 2196
长发绾君心
长发绾君心 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条回答
  •  闹比i
    闹比i (楼主)
    2020-11-22 05:14

    Yes, see: link, but he used xml layouts, not activities to create new tab, so put his xml code (set paddingTop for FrameLayout - 0px) and then write the code:

    public class SomeActivity extends ActivityGroup {
    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
    
        TabHost tab_host = (TabHost) findViewById(R.id.edit_item_tab_host); 
    
        tab_host.setup(this.getLocalActivityManager());
    
        TabSpec ts1 = tab_host.newTabSpec("TAB_DATE"); 
        ts1.setIndicator("tab1"); 
        ts1.setContent(new Intent(this, Registration.class)); 
        tab_host.addTab(ts1); 
    
        TabSpec ts2 = tab_host.newTabSpec("TAB_GEO"); 
        ts2.setIndicator("tab2"); 
        ts2.setContent(new Intent(this, Login.class)); 
        tab_host.addTab(ts2); 
    
        TabSpec ts3 = tab_host.newTabSpec("TAB_TEXT"); 
        ts3.setIndicator("tab3"); 
        ts3.setContent(new Intent(this, Registration.class)); 
        tab_host.addTab(ts3); 
    
        tab_host.setCurrentTab(0);      
    
    
    }
    

    }

提交回复
热议问题