<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                #### 7.2.1 LayoutAnimation LayoutAnimation作用于ViewGroup,為ViewGroup指定一個動畫,這樣當它的子元素出場時都會具有這種動畫效果。這種效果常常被用在ListView上,我們時常會看到一種特殊的ListView,它的每個item都以一定的動畫的形式出現,其實這并非什么高深的技術,它使用的就是LayoutAnimation。LayoutAnimation也是一個View動畫,為了給ViewGroup的子元素加上出場效果,遵循如下幾個步驟。 (1)定義LayoutAnimation,如下所示。 // res/anim/anim_layout.xml <layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android" android:delay="0.5" android:animationOrder="normal" android:animation="@anim/anim_item"/> 它的屬性的含義如下所示。 * android:delay 表示子元素開始動畫的時間延遲,比如子元素入場動畫的時間周期為300ms,那么0.5表示每個子元素都需要延遲150ms才能播放入場動畫。總體來說,第一個子元素延遲150ms開始播放入場動畫,第2個子元素延遲300ms開始播放入場動畫,依次類推。 * android:animationOrder 表示子元素動畫的順序,有三種選項:normal、reverse和random,其中normal表示順序顯示,即排在前面的子元素先開始播放入場動畫;reverse表示逆向顯示,即排在后面的子元素先開始播放入場動畫;random則是隨機播放入場動畫。 * android:animation 為子元素指定具體的入場動畫。 (2)為子元素指定具體的入場動畫,如下所示。 // res/anim/anim_item.xml <? xml version="1.0" encoding="utf-8"? > <set xmlns:android="http://schemas.android.com/apk/res/android" android:duration="300" android:interpolator="@android:anim/accelerate_interpolator" android:shareInterpolator="true" > <alpha android:fromAlpha="0.0" android:toAlpha="1.0" /> <translate android:fromXDelta="500" android:toXDelta="0" /> </set> (3)為ViewGroup指定android:layoutAnimation屬性:android:layoutAnimation= "@anim/anim_layout"。對于ListView來說,這樣ListView的item就具有出場動畫了,這種方式適用于所有的ViewGroup,如下所示。 <ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:layoutAnimation="@anim/anim_layout" android:background="#fff4f7f9" android:cacheColorHint="#00000000" android:divider="#dddbdb" android:dividerHeight="1.0px" android:listSelector="@android:color/transparent" /> 除了在XML中指定LayoutAnimation外,還可以通過LayoutAnimationController來實現,具體代碼如下所示。 ListView listView = (ListView) layout.findViewById(R.id.list); Animation animation = AnimationUtils.loadAnimation(this, R.anim.anim_ item); LayoutAnimationController controller = new LayoutAnimationController (animation); controller.setDelay(0.5f); controller.setOrder(LayoutAnimationController.ORDER_NORMAL); listView.setLayoutAnimation(controller);
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看