Android 自定义拍摄按钮

作者: Senierr | 来源:发表于2017-05-22 14:33 被阅读0次

在做一些有关录像、拍照的功能时,经常需要用到拍摄按钮。一般情况下使用UI切图。
现在,我把它封装为一个普通的View,使用时,直接引用。
既减少了APK体积,又可以自由定制颜色样式。同时,还提供了倒计时进度条。

项目地址

ShootButton

基本用法

1. 导入仓库

maven { url 'https://jitpack.io' }

2. 添加依赖

compile 'com.github.senierr:ShootButton:1.0.4'

3. XML

<com.senierr.shootbutton.ShootButton
    app:circleColor="@color/colorAccent"
    app:circleWidth="8dp"
    app:centerColor="@color/colorAccent"
    app:centerMode="roundRect"
    app:centerPadding="8dp"
    app:centerRectRadius="8dp"
    app:progressBgColor="@color/colorPrimary"
    app:progressColor="@color/colorPrimaryDark"
    app:maxProgress="100"
    app:progress="0"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

参数说明

参数名 说明
circleWidth 圆环宽度 dimension
circleColor 圆环颜色 color
progressBgColor 进度条底色 color
progressColor 进度条颜色 color
centerMode 中心图标类型 circle/roundRect
centerColor 中心图标颜色 color
centerPadding 中心图标与圆环间距 dimension
centerRectRadius 矩形图标圆角半径 dimension
maxProgress 进度最大值 integer
progress 进度值 integer

演示

准备录制
正在录制
准备拍照
拍照倒计时

Enjoy it!

相关文章

网友评论

    本文标题:Android 自定义拍摄按钮

    本文链接:https://www.haomeiwen.com/subject/sqnbxxtx.html