Action Bar detect back button click in fragment

后端 未结 3 473
独厮守ぢ
独厮守ぢ 2021-01-21 06:30

I have a Fragment with action bar back button enabled in it.

Code :

@Override
    public void onAttach(Activity activity) {
        super.onAttach(activi         


        
3条回答
  •  迷失自我
    2021-01-21 07:21

    View cView = getLayoutInflater().inflate(R.layout.header, null);
    cView.findViewById(R.id.btn_id).setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
                         // Do stuff here.
        }
    });
    actionBar.setCustomView(cView);
    

提交回复
热议问题