0

I have more than 800 images which I want to load in HorizontalListview like this image

enter image description here

This is custome listview and xml file for that is :- list_row_third.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/llHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:descendantFocusability="blocksDescendants"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/ivHorizontalOne"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_margin="3dp"
        android:gravity="center"
        android:scaleType="fitXY" />

    <ImageView
        android:id="@+id/ivHorizontalTwo"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_margin="3dp"
        android:gravity="center"
        android:scaleType="fitXY" />

    <ImageView
        android:id="@+id/ivHorizontalThree"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_margin="3dp"
        android:gravity="center"
        android:scaleType="fitXY" />

    <ImageView
        android:id="@+id/ivHorizontalFour"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_margin="3dp"
        android:gravity="center"
        android:scaleType="fitXY" />

    <ImageView
        android:id="@+id/ivHorizontalFive"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_margin="3dp"
        android:gravity="center"
        android:scaleType="fitXY" />

</LinearLayout>

main.xml file is

<com.meetme.android.horizontallistview.HorizontalListView
        android:id="@+id/listRight"
        android:layout_width="match_parent"
        android:layout_height="183dp"
        android:layout_alignParentBottom="true"
        android:background="@android:color/black"
        android:descendantFocusability="blocksDescendants"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:scrollingCache="false"
        android:smoothScrollbar="true"
        >
    </com.meetme.android.horizontallistview.HorizontalListView>
</RelativeLayout>

Now on getView method if I implement

     setOnClickListener

scrollview sometime does not scrolling, if I remove click event from each imageitem, it will work fine

I have seen Android ListView with clickable items in it's rows causes problems continuing scrolling

and I have implemented android:descendantFocusability="blocksDescendants"

but it does not work and in some question it is suggested to use

onItemClickListener but in that I can not find which imageview is clicked

Community
  • 1
  • 1
Siddhpura Amit
  • 14,534
  • 16
  • 91
  • 150
  • com.meetme.android.horizontallistview.HorizontalListView is your customized listview so we can not know what you are doing in the code of that class and how you handle clicks there.. ;( However it doesn't look so custom and good to me when you have 5 fixed elements in something that looks like coloumn – Ewoks Nov 17 '14 at 12:48
  • hi @Siddhpura Amit did solve your problem? if solve please share answer .i have also same problem – DurgaPrasad Ganti Dec 05 '14 at 07:17

0 Answers0