<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          ILayoutAnimationController動(dòng)畫布局

          聯(lián)合創(chuàng)作 · 2023-09-24 07:23

          自定義 LayoutAnimationController,可任意定制 ViewGroup 實(shí)例內(nèi)部子 View 的動(dòng)畫執(zhí)行順序,1行代碼就讓你的ViewGroup擁有華麗的布局動(dòng)畫!     

          使用方法

          方法一:

          首先創(chuàng)建 ILayoutAnimationController 實(shí)例,然后將此實(shí)例作為參數(shù)為 ViewGroup 設(shè)置布局動(dòng)畫

          - 1:{@link ILayoutAnimationController#generateController(Animation, float, ILayoutAnimationController.IndexAlgorithm)}
          - 2:{@link android.view.ViewGroup#setLayoutAnimation(LayoutAnimationController)}

          方法二:

          1行代碼直接搞定,以下兩種方法任選

          - {@link ILayoutAnimationController#setLayoutAnimation(ViewGroup, int, float, ILayoutAnimationController.IndexAlgorithm)}
          - {@link ILayoutAnimationController#setLayoutAnimation(ViewGroup, Animation, float,ILayoutAnimationController.IndexAlgorithm)}

          示例代碼:

          LinearLayout ll = (LinearLayout) findViewById(R.id.ll);
          //兩行代碼設(shè)置布局動(dòng)畫:
          ILayoutAnimationController controller = ILayoutAnimationController.generateController(AnimationUtils.loadAnimation(this,R.anim.activity_open_enter),0.8f,ILayoutAnimationController.IndexAlgorithm.INDEXSIMPLEPENDULUM);
          ll.setLayoutAnimation(controller);
          
          //一行代碼直接搞定:
          ILayoutAnimationController.setLayoutAnimation(ll,R.anim.activity_open_enter,0.8f,ILayoutAnimationController.IndexAlgorithm.INDEXSIMPLEPENDULUM);
          
          方法setLayoutAnimation中各參數(shù)介紹:
          /**
           * 根據(jù)傳入的動(dòng)畫資源ID、單個(gè)子View動(dòng)畫延時(shí)、子View動(dòng)畫執(zhí)行順序算法枚舉值 創(chuàng)建一個(gè)新的CustomLayoutAnimationController實(shí)例,
           * 將此實(shí)例作為參數(shù)為viewGroup設(shè)置布局動(dòng)畫
           * @param viewGroup
           * @param animResId
           * @param delay
           * @param indexAlgorithm
           */
          public static void setLayoutAnimation(@NonNull ViewGroup viewGroup,@AnimRes int animResId, float delay,@Nullable final IndexAlgorithm indexAlgorithm){
              Animation animation = AnimationUtils.loadAnimation(viewGroup.getContext(),animResId);
              setLayoutAnimation(viewGroup,animation,delay,indexAlgorithm);
          }

          注意

          使用 ILayoutAnimationController 獲取的 ILayoutAnimationController 實(shí)例,調(diào)用 setOrder(int order) 方法無效!

          瀏覽 24
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  日韩人妻无码电影 | 亚洲天天干 | 欧美性爱第1页 | 久草2024 | 日韩视频在线播放 |