android的适配器用于,在Android中实现适用于RecyclerView的适配器

的问题是,该教程使用RecyclerView,我有另一种看法,我想使用的只是一个简单的ScrollView具有相对的观点:

xmlns:app="http://schemas.android.com/apk/res-auto"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:paddingLeft="20dp"

android:paddingRight="20dp" >

android:id="@+id/loggedInTitle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentLeft="true"

android:layout_below="@+id/separator1"

android:layout_marginLeft="10dp"

android:layout_marginTop="15dp"

android:text="@string/profile_logged_in_with_title"

android:textSize="18sp" />

android:id="@+id/loggedInPlatformLogo"

android:layout_width="95dp"

android:layout_height="30dp"

android:layout_alignBottom="@+id/loggedInTitle"

android:layout_centerHorizontal="true"

android:layout_marginBottom="-4dp"

android:layout_marginLeft="30dp"

android:layout_toRightOf="@+id/loggedInTitle"

android:background="@drawable/facebook_logo"

android:gravity="center_horizontal|center_vertical" />

android:id="@+id/separator2"

android:layout_width="match_parent"

android:layout_height="1dp"

android:layout_alignLeft="@+id/separator1"

android:layout_below="@+id/loggedInTitle"

android:layout_marginTop="17dp"

android:background="@android:color/darker_gray" />

android:id="@+id/homeIcon"

android:layout_width="30dp"

android:layout_height="30dp"

android:layout_alignLeft="@+id/loggedInTitle"

android:layout_below="@+id/separator2"

android:layout_marginTop="10dp"

android:background="@drawable/home_icon" />

android:id="@+id/homeTitle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignBottom="@+id/homeIcon"

android:layout_marginBottom="4dp"

android:layout_marginLeft="15dp"

android:layout_toRightOf="@+id/homeIcon"

android:text="@string/profile_home_title"

android:textSize="18sp"

android:textStyle="bold" />

android:id="@+id/homeAddressEdit"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/homeIcon"

android:layout_below="@+id/homeIcon"

android:layout_marginTop="2dp"

android:ems="10"

android:hint="@string/profile_home_address_hint"

android:inputType="textAutoComplete"

android:textSize="16sp" />

android:id="@+id/separator3"

android:layout_width="match_parent"

android:layout_height="1dp"

android:layout_alignLeft="@+id/separator1"

android:layout_below="@+id/homeAddressEdit"

android:layout_marginTop="8dp"

android:background="@android:color/darker_gray" />

android:id="@+id/workIcon"

android:layout_width="30dp"

android:layout_height="30dp"

android:layout_alignLeft="@+id/homeIcon"

android:layout_below="@+id/separator3"

android:layout_marginTop="10dp"

android:background="@drawable/work_icon" />

android:id="@+id/workTitle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignBottom="@+id/workIcon"

android:layout_marginBottom="4dp"

android:layout_marginLeft="15dp"

android:layout_toRightOf="@+id/workIcon"

android:text="@string/profile_work_title"

android:textSize="18sp"

android:textStyle="bold" />

android:id="@+id/workAddressEdit"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/workIcon"

android:layout_below="@+id/workIcon"

android:layout_marginTop="2dp"

android:ems="10"

android:hint="@string/profile_work_address_hint"

android:inputType="textAutoComplete"

android:textSize="16sp" />

android:id="@+id/separator4"

android:layout_width="match_parent"

android:layout_height="1dp"

android:layout_alignLeft="@+id/separator1"

android:layout_below="@+id/workAddressEdit"

android:layout_marginTop="8dp"

android:background="@android:color/darker_gray" />

android:id="@+id/privacyIcon"

android:layout_width="30dp"

android:layout_height="30dp"

android:layout_alignLeft="@+id/workIcon"

android:layout_below="@+id/separator4"

android:layout_marginTop="13dp"

android:background="@drawable/privacy_icon" />

android:id="@+id/privacyTitle"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignBottom="@+id/privacyIcon"

android:layout_marginBottom="4dp"

android:layout_marginLeft="15dp"

android:layout_toRightOf="@+id/privacyIcon"

android:text="@string/profile_privacy_title"

android:textSize="18sp"

android:textStyle="bold" />

android:id="@+id/privacySpinner"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignLeft="@+id/privacyIcon"

android:layout_below="@+id/privacyIcon"

android:layout_marginBottom="4dp"

android:layout_marginTop="-3dp"

android:entries="@array/profile_privacy_settings"

android:prompt="@string/profile_privacy_title" />

于是,我就代替RecyclerView在该教程的布局xml引用了这个视图,但结果是我无法滚动视图。 我想这是因为ScrollView与灵活的空间模式不兼容。

下一页尝试尝试上述ScrollView布局转换适配器才能使用RecyclerViewfollowing this Android Developers example,但我不知道该怎么做,因为我得到了太多的元素结合和示例由简单的阵列字符串。

为了匹配上面的布局或其他更简单的解决方案(也许RecyclerView不是最好的方向),如果它存在,我真的很感激适配器的样子。

2015-07-11

Jjang

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值