一个带时间的相册页面(仿小米相册)

本文介绍了如何创建一个类似小米相册的页面,重点在于实现按照日期展示图片的功能,并在子线程中加载数据。作者经过两天的研究,最终在昨晚成功实现了这一功能。
摘要由CSDN通过智能技术生成

一个带时间的相册页面,真小米手机仿小米相册



这个我研究了两天,真要命,昨晚搞出来的。在这里我们用了以下gradle:

compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:recyclerview-v7:24.2.1'

compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.truizlop.sectionedrecyclerview:library:1.0.0'
 
第一个是卡片,点了有水波效果,
第 2个是你们懂得看名字就知道,
第3个是安卓官方推荐的处理图片的框架,
第4个是一个带头部分组栏的适配器.

首先你们看到的布局,我们来写:
主布局
 
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    tools:context="com.bbg.textalbum.MainActivity">


<android.support.v7.widget.RecyclerView
    android:layout_width="match_parent"
    android:id="@+id/RV"
    android:layout_height="match_parent">

</android.support.v7.widget.RecyclerView>
</RelativeLayout>
时间的item:


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="wrap_content"
    android:layout_height="wrap_content">
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginStart="10dp"
    android:id="@+id/headTV"
    android:text="159.8.5"
    android:gravity="center"/>
</LinearLayout>
然后是中间imgview:
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值