android - Custom Listview inside scrollview with horizontal gridview -
i have integrated listview inside scrollview in android. listview customised. each listview item horizontal gridview. whole screen consists of image @ top , below listview , each listitem horizontal gridview. when scrolling screen vertically works fine. once scroll item of lisview horizontally, app starts lagging , no scroll works properly.
i want develop ui same of wynk music app home screen (dynamic listview each listview item horizontal gridview).
find code below : main activity layout:
<linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:weightsum="3" android:background="@color/white" android:gravity="center_vertical" style="@style/base.widget.appcompat.light.actionbar.tabtext" > <imageview android:layout_width="0dp" android:layout_height="wrap_content" android:id="@+id/imageview4" android:gravity="center" android:src="@drawable/location" android:layout_weight="0.5" /> <textview android:layout_width="0dp" android:layout_height="match_parent" android:textappearance="?android:attr/textappearancesmall" android:text="temp location" android:gravity="center" android:id="@+id/textview" android:layout_weight="2" /> <textview android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.5" android:textappearance="?android:attr/textappearancesmall" android:text="edit" android:textcolor="@color/colorprimary" android:gravity="center" android:id="@+id/textview1" /> </linearlayout> <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="0dp" android:weightsum="9" android:layout_weight="9" android:background="@color/grey" xmlns:android="http://schemas.android.com/apk/res/android"> <imageview android:layout_width="match_parent" android:layout_height="0dp" android:scaletype="fitxy" android:src="@drawable/offerbanner3" android:layout_weight="3" /> <com.designtest.nonscrolllistview android:layout_width="match_parent" android:layout_height="0dp" android:background="@color/white" android:dividerheight="10.0sp" android:layout_weight="6" android:id="@+id/lvvendors" /> </linearlayout> </linearlayout> </scrollview>
listview item :
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingtop="10dp" android:weightsum="10" android:orientation="vertical"> <textview android:layout_width="match_parent" android:layout_height="0dp" android:text="vendor name" android:paddingleft="10dp" android:layout_weight="2" android:textcolor="@color/colorprimary" android:id="@+id/tvvendornames" android:layout_marginbottom="5dp" android:textsize="15dp"/> <horizontalscrollview android:layout_width="match_parent" android:layout_height="0dp" android:scrollbars="none" android:layout_weight="8" android:id="@+id/title_horizontalscrollview" android:layout_margin="1dp" android:fillviewport="false"> <linearlayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" > <gridview android:layout_width="fill_parent" android:layout_height="match_parent" android:id="@+id/gvproductlist" android:numcolumns="2" android:horizontalspacing="15dp" android:layout_gravity="center" /> </linearlayout> </horizontalscrollview> </linearlayout>
and item of horizontal gridview :
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" android:weightsum="8.5" > <imageview android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="5" android:scaletype="fitxy" android:id="@+id/ivproduct" /> <textview android:layout_width="match_parent" android:layout_height="0dp" android:text="product name" android:textsize="12dp" android:layout_margintop="3dp" android:id="@+id/tvproductnamelist" android:textcolor="@color/colorprimary" android:gravity="center_vertical" android:layout_weight="1.5"/> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="2" android:weightsum="3"> <textview android:layout_width="0dp" android:layout_height="match_parent" android:text="300" android:drawableleft="@drawable/rs" android:textsize="12dp" android:drawablepadding="4dp" android:textcolor="@color/colorprimary" android:gravity="center|left" android:id="@+id/tvproductpricelist" android:layout_weight="2"/> <imageview android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center" android:src="@drawable/veg" android:layout_weight="1"/> </linearlayout> </linearlayout>
Comments
Post a Comment