android中 layer-list跟include的使用

android中 layer-list和include的使用

layer-list 看来是图层的累加 我是这么理解的,字面上是多个层,也就是呢你可以把多个leyaer放在一起然后一其显现出来 如qqw.xml

view plaincopy to clipboardprint?
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">  
  3.    <item>  
  4.       <shape>  
  5.          <solid android:color="#FF00ff00" />  
  6.          <gradient    
  7.                   android:useLevel="true"    
  8.                  android:type="sweep"    
  9.                   android:startColor="#ff000000"    
  10.                   android:endColor="#ffff0000" />   
  11.       </shape>  
  12.    </item>  
  13.     <item>    
  14.         <rotate    
  15.            android:pivotX="50%" android:pivotY="50%"    
  16.             android:fromDegrees="0" android:toDegrees="80"    
  17.            android:drawable="@drawable/icon" />    
  18.     </item>    
  19.     
  20. </layer-list>  
 

 

然后就可以在别处引用了

view plaincopy to clipboardprint?
  1. <ImageButton android:id="@+id/btnFindMe"    
  2.         android:layout_width="wrap_content"    
  3.         android:layout_height="wrap_content"   
  4.        android:layout_centerInParent="true"  
  5.         android:background="@drawable/qqw"/>  

 

例如在 android:style/Widget.ProgressBar.Large 或者其他的progressbar风格

view plaincopy to clipboardprint?
  1. <mce:style name="progressBarStyleSmall" parent="android:style/Widget.ProgressBar.Large"><!-- 
  2. <item name="android:indeterminateDrawable">@drawable/progress</item> 
  3. --></mce:style><style name="progressBarStyleSmall" parent="android:style/Widget.ProgressBar.Large" mce_bogus="1"><item name="android:indeterminateDrawable">@drawable/progress</item></style>  
  4. <layer-list xmlns:android="http://schemas.android.com/apk/res/android">  
  5.    <!--   <item android:drawable="@android:drawable/progress_circular_background" />-->  
  6.      <!--  <item>  
  7.       
  8.     
  9.         <shape android:shape="ring"  
  10.                android:innerRadiusRatio="3.4"  
  11.                android:thicknessRatio="6.0">  
  12.             <gradient  
  13.                    android:useLevel="true"  
  14.                    android:type="sweep"  
  15.                    android:startColor="#ff000000"  
  16.                    android:endColor="#ffffffff" />  
  17.         </shape>  
  18.           
  19.             
  20.     </item> -->  
  21.     <item>  
  22.         <rotate  
  23.             android:pivotX="50%" android:pivotY="50%"  
  24. padding-top: 0px !important; padding-right: 3px !important; padding-bottom: 0px !important; padding-left: 10px !important; border-top-style: none; border-right-style: none; border-bottom-style: no

文章评论