Android 自定义拍摄按钮

在做一些有关录像、拍照的功能时,经常需要用到拍摄按钮。一般情况下使用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!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容