Android Drawable資源歸納

來源:互聯網
上載者:User

標籤:

                                                                           Android Drawable資源歸納

         ClipDrawable代表從其他位元影像上截取一個“圖片片段”(其他動畫XML資源都放在/res/drawable/路徑下)
clip標籤,<clip />

        AnimationDrawable ,包括補間動畫和逐幀動畫
//定義補間動畫的XML資源檔以<set.../>元素作為根項目,該元素內可以指定四個子項目,定義補間動畫XML資源應該放在/res/anmi路徑下,Interpolator,“插值”,動畫過渡的方式
 <set>    //補間動畫xml資源檔
   <alpha/>//透明度
   <scale/>//大小
   <translate/>位置
   <rotate/>旋轉
  </set>

//逐幀動畫XML資源檔以<animation_list../>元素作為根項目,定義逐幀動畫xml資源檔放在res/drawable/路徑下
  <animation_list>
     <item/>
     <item/>
      ....
  <animation_list>
  AnimationDrawable包括ScaleDrawable,RotateDrawable
          ScaleDrawable是對一個Drawable進行縮放操作,可以根據level屬性控制這個drawable的縮放比率,也可以設定他在容器     中的對齊。在XML資源檔使用scale作為根節點來建立RotateDrawable.
      <scale.../>
          RotateDrawable是對一個Drawable進行旋轉操作,可以根據level屬性控制這個drawable的旋轉角度,也可以設定相對於他  所在容器的對齊。在XML資源檔中使用rotate作為根節點來定義RotateDrawable.
  <rotate.../>

        LayerDrawable Drawable數組(圖層疊加效果)
<layer_list />

        ShapeDrawable(GradientDrawable)用XML資源檔定義一個基本的幾何圖形
<shape  xmls:android="http://schemas.android....>
   android:shape=""//選擇幾何圖形形狀
   <corners/> 
   <size/>
   <gradient/>
   <padding/>
   <soild/>
   <stroke/>
</shape>


        StateListDrawable對象所顯示的Drawable對象會隨著目標組件狀態的改變而自動切換
android:state_xxx:指定一個特定狀態


        BitmapDrawable
在xml資源檔中使用bitmap作為根節點來定義BitmapDrawable.
在xml資源問價中使用bitmap作為子節點和其他父節點一起使用
  <Bitmap />標籤位元影像參考:http://blog.csdn.net/pingchuanyang/article/details/9239271

屬性動畫
 屬性動畫是增強版的補間動畫,可以自訂View組件
 可以自訂動畫效果,再附加到組件上,就可以得到動畫效果了


參考:http://keeganlee.me/post/android/20150916
http://blog.csdn.net/ouyang_peng/article/details/8800743

Android Drawable資源歸納

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.