Restore default actionbar layout

前端 未结 2 1565
臣服心动
臣服心动 2021-02-14 05:41

I apply a custom View to the ActionBar, like this

// Inflate the \"Done/Discard\" custom ActionBar view.
LayoutInflater inflater = (La         


        
2条回答
  •  执笔经年
    2021-02-14 06:02

    ActionBar actionbar;
    
    actionbar = getActionBar();
    
    Button cls = (Button)findViewById(R.id.btn_close);
    
    cls.setOnClickListener(new OnClickListener(){           
        public void onClick(View view){
           actionbar.setDisplayShowCustomEnabled(false);                
       }            
    });
    

    Note: The button with id 'btn_close' was located in the custom actionbar layout.This function was written in mainactivity.

    Hope this Helps!!

提交回复
热议问题