FragmentTabHost bottom TabWidget

前端 未结 3 1867
花落未央
花落未央 2020-12-17 06:32

Hello How I can create bottom TabWidget in FragmentTabHost ? My xml looks line this:


3条回答
  •  余生分开走
    2020-12-17 07:01

    I came up with this solution after six hrs effort on it..

    
    
    
    
        
    
        
    
            
        
    
    
    

    Update:

    For implementing custom tabs:

    mTabHost.addTab(setIndicator(mTabHost.newTabSpec("Tab1"),
                            R.drawable.image1),
    
        public TabSpec setIndicator(Context ctx,TabSpec spec, int resid) {
            // TODO Auto-generated method stub
            View v = LayoutInflater.from(ctx).inflate(R.layout.tabs_text, null);
            v.setBackgroundResource(resid);
            TextView text = (TextView) v.findViewById(R.id.tab_title);
            text.setText(spec.getTag());
            return spec.setIndicator(v);
        }
    

    Parameter resid as Drawable like below :

    
    
    
        
        
        
    
    
    

    https://github.com/rameshkec85/BottomTabsFragmentTabHost

提交回复
热议问题