I have an ImageButton
that is by default invisible
:
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/anchor"
android:src="@drawable/anchor"
android:elevation="6dp"
android:layout_below="@+id/rl_row_progress_bar"
android:layout_centerHorizontal="true"
android:visibility="invisible"/>
On the activity I change It's attribute with this code :
if(lastPotition == 1){
mImageButton.setVisibility(View.GONE);
} else{
mImageButton.setVisibility(View.VISIBLE);
}
The problem is that in pre lollipop the Image Button works fine but in APIs 21 and 22 doesn't work
This is the declaration of the ImageButton
:
private ImageButton mImageButton;
mImageButton =(ImageButton)v.findViewById(R.id.anchor); //anchor
Thank you for the help.