像脸书饲料,如果图片超过5,那么剩余的图片计数与+是显示如下,I would like implement same in my app feed,如何处理它与回收视图,任何建议请。
发布于 2016-06-02 22:40:15
在适配器中创建如下布局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/simpleImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
visibility="gone">
<ImageView
android:id="@+id/simpleImageWithNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="+5"/>
</RelativeLayout>
</RelativeLayout>在ViewHolder中初始化这两个镜像。
并在onBindViewHolder()中检查位置,如果是4,则加载simpleImageWithNumber,否则加载simpleImage。
https://stackoverflow.com/questions/37593227
复制相似问题