安卓时间线布局及多样进度源码

showcase.png

Line Padding around marker

<com.github.vipulasri.timelineview.TimelineView
    android:id="@+id/timeline"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    app:markerSize="20dp"
    app:lineWidth="2dp"
    app:startLineColor="@color/colorPrimary"
    app:endLineColor="@color/colorPrimary"
    app:linePadding="5dp"/>
  • Configure using xml attributes or setters in code:

    Attribute NameDefault ValueDescription
    app:marker="@drawable/marker"Green Colored Oval Drawablesets marker drawable
    app:markerSize="25dp"25dpsets marker size
    app:markerInCenter="false"truesets the marker in center of line if `true`
    app:startLineColor="@color/primarColor"Dark Grey Linesets start line color
    app:endLineColor="@color/primarColor"Dark Grey Linesets end line color
    app:lineWidth="2dp"2dpsets line width
    app:lineOrientation="horizontal"verticalsets orientation of line ie `horizontal` or `vertical`
    app:linePadding="5dp"0dpsets line padding around marker
    app:lineStyle="dash"normalsets line style ie `normal` or `dashed`
    app:lineStyleDashGap="4dp"4dpsets line dash gap
    app:lineStyleDashLength="8dp"8dpsets line dash length
  • RecyclerView Holder : Your RecyclerViewHolder should have an extra parameter in constructor i.e viewType from onCreateViewHolder. You would also have to call the method initLine(viewType) in constructor definition.

    public class TimeLineViewHolder extends RecyclerView.ViewHolder {        public  TimelineView mTimelineView;        public TimeLineViewHolder(View itemView, int viewType) {            super(itemView);
            mTimelineView = (TimelineView) itemView.findViewById(R.id.timeline);
            mTimelineView.initLine(viewType);
        }
    }
  • RecyclerView Adapter : override getItemViewType method in Adapter

    @Override
    public int getItemViewType(int position) {        return TimelineView.getTimeLineViewType(position, getItemCount());
    }

And pass the viewType from onCreateViewHolder to its Holder.

    @Override
    public TimeLineViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {        View view = View.inflate(parent.getContext(), R.layout.item_timeline, null);        return new TimeLineViewHolder(view, viewType);
    }

源码下载

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android 时间轴相册码是一个基于Android平台开发的应用程序,旨在帮助用户轻松地浏览和管理他们的照片和视频。该应用使用时间轴的方式展示用户的照片和视频,可以根据时间线来浏览和查找特定时间段内的媒体文件。 该码项目采用了MVC架构模式,使用Java语言编写,并通过Android Studio进行开发。应用程序主要包括以下几个功能模块: 1. 时间轴展示:通过时间轴的方式展示用户的照片和视频,用户可以向前或向后滑动时间轴,浏览不同时间段内的媒体文件。 2. 图片和视频管理:用户可以在时间轴上选择特定的日期,查看该日期内的所有照片和视频,还可以进行删除、重命名、移动等操作。 3. 分享和备份:用户可以通过应用内的分享功能将照片和视频分享给其他社交平台,还可以通过备份功能将媒体文件备份到云存储或本地存储空间。 4. 设置和个性化:应用提供了一系列设置选项,用户可以根据自己的喜好进行个性化设置,如主题颜色、布局样式等。 通过该时间轴相册码,开发者可以学习到Android应用开发的相关知识,包括UI设计、网络请求、数据库操作等,并且可以根据自己的需要进行定制和扩展。同时,该应用也为用户提供了一种新颖的浏览和管理照片、视频的方式,帮助用户更好地组织和回忆自己的生活。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值