Adding a fragment on top of another fragment onClickListener issue

后端 未结 3 1162
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-07 02:53

I\'m adding a fragment to an activity instead of replacing the current fragment (because this corresponds to the type of behavior I want to hav

3条回答
  •  轮回少年
    2021-02-07 03:48

    well,I think the best way is set onClickListener to the locateView which you click on the top-fragment .

    if you use the way android:clickable="true" answered by The Metal Beard, and also you set any ImageView's selector states (see below), then you will find the bug : if you click the other space place ,the imageView will change the status.

    
    
    
        
        
    
    

    if the clicked View on top-fragment is mBootomLayout,just do it like this:

    mBootomLayout.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            }
        });
    

提交回复
热议问题