Setting selected TAB with a small triangle below it

前端 未结 3 1498
逝去的感伤
逝去的感伤 2020-12-09 22:17

I want my tabs to show like in the image with small triangle below it.Is this possible ?If yes, then help me with some codes or documentation.

3条回答
  •  盖世英雄少女心
    2020-12-09 22:53

    tab_0_info.xml:

    
    
        
        
    
    
    
    private void addTab(int resouceTabId, int drawableId,
            Class groupActivityClass)
    {
        Intent intent = new Intent(this, groupActivityClass);
        TabHost.TabSpec spec = tabHost.newTabSpec("tab" + resouceTabId);
    
        View tabIndicator = LayoutInflater.from(this).inflate(
                R.layout.tab_indicator, getTabWidget(), false);
    
        TextView title = (TextView) tabIndicator.findViewById(R.id.title);
        title.setText(resouceTabId);
        ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
        icon.setImageResource(drawableId);
    
        spec.setIndicator(tabIndicator);
        spec.setContent(intent);
        tabHost.addTab(spec);
    
    }
    
    //addTab(R.string.yourTabTitle, R.drawable.tab_0_info, YourGroup.class);
    

提交回复
热议问题