Nothings Happening On Clicking Items Of Gridview
Solution 1:
Set ItemClickListener for items of GridView in it's adapter,instead of set an ItemClickListener directly for GridView.
view.imgViewJewel.setItemClickListener(activity);
Solution 2:
Please change your xml to this-
Add thease 2 line-
android:clickable="true"
android:focusable="false"
<?xml version="1.0" encoding="utf-8"?><FrameLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent" ><com.myjewelbox.SquareImageButtonViewandroid:id="@+id/picture"android:layout_width="match_parent"android:layout_height="130dp"android:clickable="true"android:focusable="false"android:focusableInTouchMode="false"android:scaleType="fitCenter" /><TextViewandroid:id="@+id/tvtext"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_gravity="bottom"android:background="#55000000"android:focusable="false"android:focusable="false"android:focusableInTouchMode="false"android:paddingBottom="10dp"android:paddingLeft="10dp"android:paddingRight="1dp"android:paddingTop="10dp"android:textColor="@color/Golden" /></FrameLayout>
And for more detail see here- http://www.androidhub4you.com/2013/07/custom-grid-view-example-in-android.html
Solution 3:
In your adapter class, setOnClickListener on your convertView before return line.
convertView.setOnClickListener(newonClickListener(){
//In this method you can get the items same as you are getting in your//adapter, as follow:-String name=listJewel_name.get(position);
//or you can do whatever you want as now you have the whole view that is //clicked, so you can event get its children or start a new activity or //whatever you want
}
return converView;
Solution 4:
Make Sure android:focusable="false"
in your First Child
of GridView Layout
and
GridViews
can't handle clickable items. Button
for example won't work. And also if you have any other non-clickable
item, you have to make sure that you didn't set the property: clikable="true".
Refer below link - It is same as what you expect
http://www.androidhub4you.com/2013/07/custom-grid-view-example-in-android.html
Post a Comment for "Nothings Happening On Clicking Items Of Gridview"