
如何将vertical recyclervIEw放在horizontalScrollvIEw中?
当适配器在视图符号处绑定数据时,项目的左边距会增加.
(例如:leftmargin = position * 100)
但是不能正常使用horizontalScrollvIEw.
帮帮我吧~~
对不起,我的英语不好.
我的活动布局.xml
<FrameLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:app="http://schemas.androID.com/apk/res-auto"androID:ID="@+ID/root"androID:layout_wIDth="match_parent"androID:layout_height="match_parent"><horizontalscrollview androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:fillVIEwport="true" androID:scrollbaralwaysDrawHorizontalTrack="true"> <linearLayout androID:layout_wIDth="match_parent" androID:layout_height="match_parent" androID:orIEntation="vertical"> <androID.support.v7.Widget.RecyclerVIEw androID:ID="@+ID/List" androID:layout_wIDth="match_parent" androID:layout_height="match_parent" /> </linearLayout></horizontalscrollview></FrameLayout>和List_item .xml
<androID.support.v7.Widget.CardVIEw xmlns:androID="http://schemas.androID.com/apk/res/androID"xmlns:card_vIEw="http://schemas.androID.com/apk/res-auto"androID:layout_wIDth="match_parent"androID:layout_height="60dp"androID:layout_margin="8dp"card_vIEw:cardCornerRadius="2dp"><linearLayout androID:orIEntation="horizontal" androID:layout_wIDth="match_parent" androID:layout_height="match_parent"> <ImageVIEw androID:ID="@+ID/icon" androID:layout_wIDth="50dp" androID:layout_height="50dp" androID:src="@drawable/bullet" /> <CheckBox androID:ID="@+ID/check" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" /> <TextVIEw androID:ID="@+ID/text" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" /></linearLayout></androID.support.v7.Widget.CardVIEw>解决方法:
如果您想要的是水平滚动的项目列表,请将linearlayoutmanager与RecyclerVIEw一起使用.
linearlayoutmanager manager = new linearlayoutmanager( this, linearlayoutmanager.HORIZONTAL, false); 总结 以上是内存溢出为你收集整理的android – recycleralview里面的horizontalscrollview全部内容,希望文章能够帮你解决android – recycleralview里面的horizontalscrollview所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)