How to display both icon and title of action inside ActionBar?

前端 未结 10 2039
庸人自扰
庸人自扰 2020-11-29 18:08

I need to display both icon and title of action inside ActionBar.

I\'ve tried \"withText\" option, but it has no

10条回答
  •  情话喂你
    2020-11-29 18:48

    You can add button in toolbar

    
    
            

    create file btn_selector.xml in drawable

    
    

    
    
    

    java:

    private boolean isSelect = false;

    OnClickListener for button:

    private void myClick() {
        if (!isSelect) {
           //**your code**//
            isSelect = true;
        } else {//**your code**//
            isSelect = false;
        }
        sort.setSelected(isSelect);
    }
    

提交回复
热议问题