我的应用程序中有多个 TextView,并且我已经在它们上实现了 OnFocusChangeListener 和 OnClickListener,但我注意到 OnFocusChangeListener 正在阻止 OnClickListener .. 请告诉我是否有任何解决方法可以避免这种情况,因为我必须同时实现这两者。
channelMenu.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean b) {
//Toast.makeText(getActivity(),"changing Focus",2000).show();
if (b) {
channelMenu.setShadowLayer(GLOW, 0f, 0f, Color.WHITE);
mGroupCallback.OnGroupSelected(channelMenu.getText().toString());
} else if (!b) {
channelMenu.setShadowLayer(DIM, 0f, 0f, Color.WHITE);
}
}
});
channelMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (!channelMenuExpanded) {
if(!ischannelSubMenuCreated){
createChannelSubMenu();
channelSubmenusContainer.setVisibility(View.VISIBLE);
channelMenuExpanded = true;
}else if(ischannelSubMenuCreated){
channelSubmenusContainer.setVisibility(View.VISIBLE);
channelMenuExpanded = true;
}
} else {
channelSubmenusContainer.setVisibility(View.GONE);
channelMenuExpanded = false;
}
mGroupCallback.OnGroupSelected(channelMenu.getText().toString());
}
});