I have a view that initially starts like this in the xml:
<ImageButton
android:layout_width="64dp"
android:layout_height="64dp"
android:id="@+id/likeBtn"
android:src="@drawable/like"
android:onClick="like"
android:longClickable="true"
android:clickable="true" />
and I already have a setOnLongClickListenter in the OnCreate of mainActivity, like this:
likeBtn.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
showExtraLike(v);
return true;
}
});
My problem is:
when I run a code like that
likeBtn.setClickable(false);
likeBtn.setLongClickable(false);
/* some other code here */
likeBtn.setLongClickable(true);
I found that the view becomes clickable also as well !!
I need it to be ONLY LongClickable and NOT clickable for sometime as I'll enable both again after few lines in the code.
Notes:
- Disabling both and enabling them again works fine.
- Disabling LongClick only and enabling it again works fine.
- My only problem is that setting clickable to false seems ineffective when longClickable is true!