Git Product home page Git Product logo

Comments (5)

KingJA avatar KingJA commented on September 23, 2024

@sieml 你好,不太理解你的意思,你是指要自定义一个进度动画页面吗?能否描述更具体些。

from loadsir.

xiellml avatar xiellml commented on September 23, 2024

@KingJA 假如我想把ProgressBar换成ImageView的, 使用帧动画. 这时要通过findViewById来找到这个View, 然后开启动画, 还有关闭动画 , 需要另外处理, 能封装在库中吗? 还是已经有了

from loadsir.

toothwind avatar toothwind commented on September 23, 2024

1.可以尝试在Callback类添加
protected void initView(Context context, View view){
//do nothing
}
2.在rootView = View.inflate(context, onCreateView(), null);之后调用;
public View getRootView() {
int resId = onCreateView();
if (resId == 0 && rootView != null) {
return rootView;
}
rootView = View.inflate(context, onCreateView(), null);
rootView.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
if (onRetry(context, rootView)) {
return;
}
if (onReloadListener != null) {
onReloadListener.onReload(v);
}
}
});
initView(context, rootView);
return rootView;
}
3.然后在自定义的LoadingCallback重写父类的initView;
public class LoadingCallback extends Callback {

@Override
protected int onCreateView() {
    return R.layout.layout_loading;
}

@Override
protected void initView(Context context, View view) {
    super.initView(context, view);
    ImageView ivLoading = (ImageView) view.findViewById(R.id.iv_loading);
    Animation animation = new RotateAnimation(0, 359,Animation.RELATIVE_TO_SELF,
            0.5f,Animation.RELATIVE_TO_SELF,0.5f);
    animation.setDuration(500);
    animation.setRepeatCount(Integer.MAX_VALUE);
    animation.setFillAfter(true);
    ivLoading.startAnimation(animation);//开始动画
}

}

from loadsir.

KingJA avatar KingJA commented on September 23, 2024

@sieml 非常好的使用场景,目前LoadSir没有针对该场景的相关API。下个版本会增加。@toothwind 感谢你建议,我想我会在下个版本增加相关API。

from loadsir.

KingJA avatar KingJA commented on September 23, 2024

@sieml @toothwind 感谢两位的支持,https://github.com/KingJA/LoadSir/blob/v1.2.2-pre/app/src/main/java/sample/kingja/loadsir/callback/AnimateCallback.java LoadSir v1.2.2-pre 更新API,近期将出release版本,欢迎提出意见和建议。

from loadsir.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.