Mesh click effect

I have a gridview

<GridView
    android:id="@+id/gridview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:layout_marginLeft="60px"
    android:layout_marginRight="60px"
    android:background="#343434"
    android:listSelector="#00343434"
    android:numColumns="2"
    android:verticalSpacing="25px" >
</GridView>

When I click, the click of an element is indicated in the gray color box.

I want to remove the gray effect when the item is clicked.

Please give some suggestion, thanks.

+3
source share
3 answers

change the line android:listSelector="#00343434"

with this line

android:listSelector="@android:color/transparent" 

Or using

android:listSelector="#00000000"
+11
source

When do you want to install perticular Image

View savedView    ;
gridview.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView<?> parent, View v, int position, long id) {


                        adapter.notifyDataSetChanged();


                        v.setBackgroundResource(R.drawable.bgcalendarbox_highlighted);
                            if(savedView==null)
                            {
                                savedView = v;
                            }
                            else
                            {
                                savedView.setBackgroundResource(R.drawable.bgcalendarbox);
                                savedView = v;
                            }


                }
            });

Othervise

android:listSelector="#00000000"
+1
source
android:listSelector="#00000000"

Add this to your GridView tag.

+1
source

All Articles