Reputation: 1338
I have made a gridview (in a fragment) with an adapter and a layout for the items. The layout exists of an ImageView to display a picture, a CheckBox and another ImageView to display an indicator that indicates if the picture is just a picture or if it is a thumbnail for a video. Here is the layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivGridMedia"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:contentDescription="@string/imgObjectMediaDesc"/>
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/ivGridMedia"
android:layout_alignEnd="@+id/ivGridMedia"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
<ImageView
android:id="@+id/vidIndicator"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:focusable="false"
android:focusableInTouchMode="false"
android:contentDescription="@string/imgPlayDesc"
android:visibility="gone"
android:src="@drawable/icon_play"/>
</RelativeLayout>
I'm trying to make this GridView work like the gallery app, so (in the future) the CheckBox will be invisible in the start but on a long click on the item, it will be visible and the user will be able to choose some of the pictures to do something with.
I don't want the checkBox to be focusable or clickable (I want to be able to click the item to check the checkbox), but even though I've set the checkbox not to be focusable or clickable I can still click it, does anyone know how I can fix this?
Upvotes: 1
Views: 134
Reputation: 12536
You could set android:enabled="false"
to disable the CheckBox
.
Upvotes: 2