一個為音樂播放器自定義的progress view:MaskProgressView
一個為音樂播放器自定義的progress view。
運行效果:
使用說明:
xml
<co.mobiwise.library.MaskProgressView ... app:progressEmptyColor="#4E3C51" app:progressLoadedColor="#E91E64" app:coverMaskColor="#80000000" app:durationTextColor="#FFFFFF" app:durationTextSize="15sp" app:coverImage="@drawable/cover" app:placeHolder="@drawable/cover" app:progressHeight="4dp" app:maxProgress="40" app:currentProgress="23"/>
java
MaskProgressView maskProgressView = (MaskProgressView) findViewById(R.id.maskProgressView);
Listeners
maskProgressView.setOnProgressDraggedListener(new OnProgressDraggedListener() {
@Override
public void onProgressDragged(int position) {
//update your mediaplayer with position
}
@Override
public void onProgressDragging(int position) {
//update your mediaplayer with position
}
});maskProgressView.setAnimationCompleteListener(new AnimationCompleteListener() {
@Override
public void onAnimationCompleted() {
//Called when animation completed
}
}); Control
maskProgressView.setmMaxSeconds(160); //set current track duration in seconds
maskProgressView.setCoverImage(Bitmap bitmap); //set cover image from loaded bitmap
maskProgressView.setCoverImage(R.drawable.{resource}); //set cover image from resource
maskProgressView.isPlaying() // Check if playing
maskProgressView.start(); // start or resume animation
maskProgressView.pause(); // pause animation
maskProgressView.stop(); //stop animation clears current progress 導入
Project build.gradle
repositories {
maven {
url "https://jitpack.io"
}
} Module build.gradle
dependencies {
compile 'com.github.iammert:MaskProgressView:0988c5db24'
} 設計師
設計最初由 Dawid Dapszus 在 Dribbble和 MaterialUp上分享,感謝他帶來如此有創意的設計。
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!