FAB-Loading, 在浮动动作按钮上,基于加载动画

分享于 

4分钟阅读

GitHub

  繁體 雙語
A loading animation based on Floating Action Button
  • 源代码名称:FAB-Loading
  • 源代码网址:http://www.github.com/SaeedMasoumi/FAB-Loading
  • FAB-Loading源代码文档
  • FAB-Loading源代码下载
  • Git URL:
    git://www.github.com/SaeedMasoumi/FAB-Loading.git
    Git Clone代码到本地:
    git clone http://www.github.com/SaeedMasoumi/FAB-Loading
    Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/SaeedMasoumi/FAB-Loading
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
    
    fab加载 Android Arsenal

    基于浮动动作按钮的加载动画。

    Marvel Sample Screenshots

    FAB-Loading Sample Screenshots

    用法
    • 在你的视图中包含 LoadingView 小部件:
    
    <io.saeid.fabloading.LoadingView
    
    
     android:id="@+id/loading_view"
    
    
     android:layout_width="wrap_content"
    
    
     android:layout_height="wrap_content"
    
    
     android:scaleX="1.5"//(optional)
    
    
     android:scaleY="1.5"//(optional)
    
    
     app:mfl_onclickLoading="true"//(optional)
    
    
     app:mfl_duration="200"//(optional)
    
    
     app:mfl_repeat="4"//(optional)
    
    
    />
    
    
    
    

    2.Add 加载项目。

    
     *Note that there are four types of loading animation, `LoadingView.FROM_LEFT`, `LoadingView.FROM_TOP`, `LoadingView.FROM_RIGHT`, `LoadingView.FROM_BOTTOM`.*
    
    
    
    
    
     mLoadingView = (LoadingView) findViewById(R.id.loading_view);
    
    
     mLoadingView.addAnimation(yourColor,yourDrawable,yourLoadingType);
    
    
    
    //also you can add listener for getting callback (optional)
    
    
     mLoadingView.addListener(new LoadingView.LoadingListener() {
    
    
     @Override public void onAnimationStart(int currentItemPosition) {
    
    
     }
    
    
    
     @Override public void onAnimationRepeat(int nextItemPosition) {
    
    
     }
    
    
    
     @Override public void onAnimationEnd(int nextItemPosition) {
    
    
     }
    
    
     });
    
    
    
    

    3.Call mLoadingView.startAnimation();,只要你想启动动画。

    XML属性

    XML属性相关方法描述
    mfl_onclickLoading通过单击FAB开始动画。 ( 默认值为 false )
    mfl_durationsetDuration ( int持续时间)设置每个加载项的持续时间。 ( 默认值为 500 millis )
    mfl_repeatsetRepeat ( int重复)对于大于 1的值,它会自动调用'repeat-1'时间的下一个动画。 ( 默认值为 1 )

    安装

    
    compile 'io.saeid:fab-loading:1.0.0'
    
    
    
    
    Credits

    灵感来源:http://www.materialup.com/posts/marvel-avengers-loading-animation

    许可证
    
    Copyright 2015 Saeed Masoumi.
    
    
    
    Licensed under the Apache License, Version 2.0 (the"License");
    
    
    you may not use this file except in compliance with the License.
    
    
    You may obtain a copy of the License at
    
    
    
     http://www.apache.org/licenses/LICENSE-2.0
    
    
    
    Unless required by applicable law or agreed to in writing, software
    
    
    distributed under the License is distributed on an"AS IS" BASIS,
    
    
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    
    
    See the License for the specific language governing permissions and
    
    
    limitations under the License.
    
    
    
    

    BASE  act  动画  按钮  Action  Floating  
    相关文章