Android编程实现自定义进度条颜色的方法

2019-12-10 19:50:30丽君
  • 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.easck.com/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.   --> 
  • <layer-list xmlns:android="http://www.easck.com/apk/res/android">   <item android:id="@android:id/background">  
  • <shape>   <corners android:radius="5dip" />  
  • <gradient  android:startColor="#ff9d9e9d" 
  • android:centerColor="#ff5a5d5a"  android:centerY="0.75" 
  • android:endColor="#ff747674"  android:angle="270" 
  • />   </shape>  
  • </item>   <item android:id="@android:id/secondaryProgress">  
  • <clip>   <shape>  
  • <corners android:radius="5dip" />   <gradient 
  • android:startColor="#80ffd300"  android:centerColor="#80ffb600" 
  • android:centerY="0.75"  android:endColor="#a0ffcb00" 
  • android:angle="270"  />  
  • </shape>   </clip>  
  • </item>   <item android:id="@android:id/progress">  
  • <clip>   <shape>  
  • <corners android:radius="5dip" />   <gradient 
  • android:startColor="#ffffd300"  android:centerColor="#ffffb600" 
  • android:centerY="0.75"  android:endColor="#ffffcb00"