然后在MainActivity.java中实现按钮的点击事件: publicclassMainActivityextendsAppCompatActivity{privateButtonloadingButton;privatebooleanisLoading=false;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate
loadingButton.setEnabled(false);// 禁用Button点击loadingButton.setText("");// 清空Button文本// 创建ValueAnimator对象,设置动画属性为alphaValueAnimatoranimator=ValueAnimator.ofFloat(0f,1f);animator.setDuration(1000);// 设置动画时长为1秒animator.setRepeatCount(ValueAnimator.INFINITE);// 设置动画重复次数为...
lb.loadingSuccessful(); show failed animation: lb.loadingFailed(); cancel loading: lb.cancelLoading(); reset: lb.reset(); enable: lb.setEnable(true/false); notice: lb_btnDisabledColor & lb_disabledTextColor only display while LoadingButton is normal button state, LoadingButton is playing anima...
implementation 'br.com.simplepass:loading-button-android:2.1.0' How to use Animate and revert animation Add the button in your layout file and customize it the way you like it. <br.com.simplepass.loadingbutton.customViews.CircularProgressImageButton android:id="@+id/btn_id" android:layout_width...
定义动画切换特效,anim/loading.xml <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false" > <item android:drawable="@drawable/progress_loading_image_01" android:duration="150"/> ...
Animation.INFINITE); mFanView.startAnimation(rotateAnimation); mClearButton = (Button) findViewById(R.id.clear_progress); mClearButton.setOnClickListener(this); mLeafLoadingView = (LeafLoadingView) findViewById(R.id.leaf_loading); mMplitudeText = (TextView) findViewById(R.id.text_ampair);...
定义res/anim/loading.xml如下: <?xml version="1.0" encoding="UTF-8"?> <animation-list android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:duration="150" android:drawable="@drawable/loading_01" /> ...
btnStop=(Button) findViewById(R.id.btnStop); }/*** 初始化数据*/privatevoidinitData() { btnStart.setOnClickListener(this); btnStop.setOnClickListener(this);//Sets a drawable as the content of this ImageView.imgPic.setImageResource(R.drawable.loading_anim);//给动画资源赋值animationDrawable...
button = (Button) findViewById(R.id.button); } privatevoidflipAnimation(){ final TextView visibletext; final TextView invisibletext;//逻辑判断if(textview1.getVisibility() == View.GONE) { visibletext = textview2; invisibletext = textview1; ...
/这里是从用户那里获取有没有设置文案Stringtitle=typedArray.getString(R.styleable.SmartLoadingView_textStr);if(TextUtils.isEmpty(title)){//如果获取来的属性是空,那么可以默认一个属性//(作者忘记设置了!因为已经发布后期优化,老尴尬了)buttonString="默认文案";}else{//如果有设置文案buttonString=title;}...