
我正在努力制作像钢笔画一个圆圈的动画.为此,我尝试使用自定义进度条,并尝试了不同的自定义搜索栏库,但对于具有自定义搜索栏的库,我无法设置拇指.
在图像是我想要的方向.它将从顶部开始并制作一个完整的圆圈.
我也让圈子显示,但我无法添加和同步图像同时旋转
解决方法:
请按照以下说明 *** 作:
将此库添加到项目中(gradle):
implementation 'com.github.Triggertrap:SeekArc:v1.1'请注意,由于存在错误,您需要在应用程序标记下的清单中添加此行:
tools:replace="androID:icon"在活动布局中添加视图:
我为您的偏好准备参数:
<com.triggertrap.seekarc.SeekArc androID:ID="@+ID/seekArc" androID:layout_wIDth="match_parent" androID:layout_height="wrap_content" androID:layout_gravity="center" androID:padding="30dp" app:progress="20" app:arccolor="#00ffffff" app:thumb="@drawable/ic_androIDo" app:startAngle="0" app:sweepAngle="360" app:touchInsIDe="false" androID:focusable="false" androID:clickable="false"/>在您的resource / drawable(ic_androIDo.xml)中添加此drawable:
<?xml version="1.0" enCoding="utf-8"?><vector xmlns:androID="http://schemas.androID.com/apk/res/androID"androID:wIDth="42dp"androID:height="42dp"androID:vIEwportWIDth="413.137"androID:vIEwportHeight="413.137"><path androID:fillcolor="#AAC148" androID:pathData="M311.358,136.395H101.779c-4.662,0-8.441,3.779-8.441,8.441v175.749 c0,4.662,3.779,8.441,8.441,8.441h37.363v59.228c0,13.742,11.14,24.883,24.883,24.883l0,0c13.742,0,24.883-11.14,24.883-24.883 v-59.228h34.803v59.228c0,13.742,11.14,24.883,24.883,24.883l0,0c13.742,0,24.883-11.14,24.883-24.883v-59.228h37.882 c4.662,0,8.441-3.779,8.441-8.441V144.836C319.799,140.174,316.02,136.395,311.358,136.395z" /><path androID:fillcolor="#AAC148" androID:pathData="M57.856,136.354L57.856,136.354c-13.742,0-24.883,11.14-24.883,24.883v101.065 c0,13.742,11.14,24.883,24.883,24.883l0,0c13.742,0,24.883-11.14,24.883-24.883V161.237 C82.738,147.495,71.598,136.354,57.856,136.354z" /><path androID:fillcolor="#AAC148" androID:pathData="M355.281,136.354L355.281,136.354c-13.742,0-24.883,11.14-24.883,24.883v101.065 c0,13.742,11.14,24.883,24.883,24.883l0,0c13.742,0,24.883-11.14,24.883-24.883V161.237 C380.164,147.495,369.024,136.354,355.281,136.354z" /><path androID:fillcolor="#AAC148" androID:pathData="M103.475,124.069h205.692c5.366,0,9.368-4.943,8.266-10.195 c-6.804-32.428-27.45-59.756-55.465-75.543l17.584-31.727c1.19-2.148,0.414-4.855-1.734-6.045 c-2.153-1.193-4.856-0.414-6.046,1.734l-17.717,31.966c-14.511-6.734-30.683-10.495-47.734-10.495 c-17.052,0-33.224,3.761-47.735,10.495L140.869,2.292c-1.191-2.149-3.898-2.924-6.045-1.734c-2.148,1.19-2.924,3.897-1.734,6.045 l17.584,31.727c-28.015,15.788-48.661,43.115-55.465,75.544C94.106,119.126,98.108,124.069,103.475,124.069z M267.697,76.786 c0,5.282-4.282,9.565-9.565,9.565c-5.282,0-9.565-4.282-9.565-9.565c0-5.282,4.282-9.565,9.565-9.565 C263.415,67.221,267.697,71.504,267.697,76.786z M154.508,67.221c5.282,0,9.565,4.282,9.565,9.565c0,5.282-4.282,9.565-9.565,9.565 c-5.282,0-9.565-4.282-9.565-9.565C144.943,71.504,149.225,67.221,154.508,67.221z" />Activity类中的代码:
SeekArc seekArc; int progress = 0; seekArc = (SeekArc) findVIEwByID(R.ID.seekArc); final Handler handler = new Handler(); handler.postDelayed(new Runnable(){ public voID run(){ seekArc.setProgress(progress++); if (progress >= 100) { handler.removeCallbacks(this); return; } handler.postDelayed(this, 300); } }, 50);图书馆学分到https://github.com/neild001/SeekArc
图标信用到https://www.flaticon.com/free-icon/android_174836#term=android&page=1&position=1
总结以上是内存溢出为你收集整理的android – 嵌入式动画,绘制圆圈和旋转图像全部内容,希望文章能够帮你解决android – 嵌入式动画,绘制圆圈和旋转图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)