How can I turn off the orange highlight when clicking an item in a GridView?
I haven't been able to find a solution in the documentation or through testing.
How can I turn off the orange highlight when clicking an item in a GridView?
I haven't been able to find a solution in the documentation or through testing.
Use android:listSelector="#00000000"
in your GridView
element in your XML layout file.
Another option is to reference the transparent color via @android:color/transparent
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:listSelector="@android:color/transparent"
/>
I did the same thing in code using
GridView.setSelector(new ColorDrawable(Color.TRANSPARENT));
Add this property to gridview
android:listSelector="@android:color/transparent"
<GridView
android:id="@+id/gridView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:horizontalSpacing="10dp"
android:listSelector="#00000000"
android:numColumns="3"
android:scrollbars="none"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp" />
Done! this is a solution. thank you :)
Try It...
android:listSelector="@android:color/transparent"
Just set below property in your XML file.
android:focusableInTouchMode="false"
Add android:listSelector="#00000000"
or android:listSelector="@android:color/transparent"
in your GridView XML element like bellow.
<GridView
android:id="@+id/gridView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="150dp"
android:gravity="center"
android:listSelector="#00000000"
android:numColumns="auto_fit"
android:stretchMode="columnWidth" />
© 2022 - 2024 — McMap. All rights reserved.