日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

自定义加速球效果

發布時間:2023/12/10 编程问答 41 豆豆
生活随笔 收集整理的這篇文章主要介紹了 自定义加速球效果 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一個自定義控件:

地址:

git:https://github.com/guoGavin/CustomAccelerateBall

csdn:http://download.csdn.net/detail/jiguangcanhen/8687305


accelerate ball,加速球效果,也就是圓形的ProgressBar的效果。

效果圖

錄制效果不是很好

功能

  • 可以設置目標位置,讓它自己加速到特定位置。
  • 可以設置不適用加速的動畫效果,直接設置到特定位置。
  • 可以設置是否顯示Percent。
  • 可以設置刷新速度,RefreshSpeed。
  • 可以設置加速動畫漲幅,Speed。
  • 可以設置加速過程監聽,每次變化監聽回調,加速結束回調,AccelerateBallUpdateListener。

layout

<com.test.gavinguo.customaccelerateball.AccelerateBallViewandroid:id="@+id/ball"android:layout_width="200dp"android:layout_height="200dp"android:layout_marginTop="50dp"android:layout_gravity="center_horizontal"/>

展示類型

public enum GalleryType{NoneAnimationAndPercent,//沒有動畫和百分比文字NoneAnimationHavePercent,//沒有動畫但是有文本AnimationOnly,//只有動畫AnimationAndPercent,//具有動畫和百分比,default}

動畫漲幅

public enum Speed{slow,//低速medium,//中速,defaultfast,//高速superFast,//超高速random,//隨機速度}

刷新速度

public enum RefreshSpeed{slow,//低速medium,//中速,defaultfast,//高速superFast,//超高速}

過程監聽

public interface AccelerateBallUpdateListener{/** * 每次變化 * @param currentPercent 當前百分比 */void updateLeveUp(int currentPercent);/** * 上漲結束調用 * @param endPercent 結束時候的百分比 */void endLeveUp(int endPercent);}

設置參數以及啟動

ball = (AccelerateBallView) findViewById(R.id.ball);ball.setSpeedType(AccelerateBallView.Speed.superFast);ball.setRefreshSpeedType(AccelerateBallView.RefreshSpeed.superFast);ball.setGalleryType(AccelerateBallView.GalleryType.AnimationAndPercent);ball.setAccelerateBallUpdateListener(new AccelerateBallView.AccelerateBallUpdateListener() {@Overridepublic void updateLeveUp(int currentPercent) {//do nothing}@Overridepublic void endLeveUp(int endPercent) {//do nothing}});start.setOnClickListener(this);ball.setTotalLevel(totalLevel);

Total可以不停的去設置,加速球最終會停止在最后設置的位置。


總結

以上是生活随笔為你收集整理的自定义加速球效果的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。