- 引入依赖
implementation 'com.github.Justson:CoolIndicator:v1.0.0'
-
CoolIndicatorLayout布局
public class CoolIndicatorLayout extends baseIndicatorView { CoolIndicator mCoolIndicator = null; public CoolIndicatorLayout(Context context) { this(context, null); } public CoolIndicatorLayout(Context context, @Nullable AttributeSet attrs) { this(context, attrs, -1); } @SuppressLint("UseCompatLoadingForDrawables") public CoolIndicatorLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mCoolIndicator = CoolIndicator.create((Activity) context); mCoolIndicator.setProgressDrawable(context.getResources().getDrawable(com.coolindicator.sdk.R.drawable.default_drawable_indicator, context.getTheme())); this.addView(mCoolIndicator, offerLayoutParams()); } @Override public LayoutParams offerLayoutParams() { return new frameLayout.LayoutParams(-1, AgentWebUtils.dp2px(getContext(), 3)); } @Override public void show() { this.setVisibility(View.VISIBLE); mCoolIndicator.start(); } @Override public void setProgress(int newProgress) { } @Override public void hide() { mCoolIndicator.complete(); }
将useDefaultIndicator()换成setCustomIndicator()方法
// .useDefaultIndicator() .setCustomIndicator(CoolIndicatorLayout(this))
效果
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)