Setting selected TAB with a small triangle below it

前端 未结 3 1480
逝去的感伤
逝去的感伤 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 23:14

    You can add images to layout with tabs:

    
        
        
        
        
    
    

    and add listener in your tab activity:

    getTabHost().setOnTabChangedListener(new OnTabChangeListener() {
            public void onTabChanged(String tabId) {
                if (tabId.equels("left")){
                    findViewById(R.id.down_arrow_left).setVisibility(View.VISIBLE);
                    findViewById(R.id.down_arrow_right).setVisibility(View.INVISIBLE);
                } else if (tabId.equels("right")){
                    findViewById(R.id.down_arrow_left).setVisibility(View.INVISIBLE);
                    findViewById(R.id.down_arrow_right).setVisibility(View.VISIBLE);
                }
            }
        });
    

提交回复
热议问题