国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Android > 正文

Android下修改SeekBar樣式的解決辦法

2020-04-11 12:11:32
字體:
來源:轉載
供稿:網友
SeekBar配置文件:
Xml代碼
復制代碼 代碼如下:

<SeekBar    
         android:id="@+id/player_seekbar"   
         android:layout_width="245px"   
         android:layout_height="25px"   
         android:progressDrawable="@drawable/seekbar_style"   
         android:thumb="@drawable/thumb"   
         android:paddingLeft="16px"   
         android:paddingRight="15px"   
         android:paddingTop="5px"   
         android:paddingBottom="5px"   
         android:progress="0"   
         android:max="0"   
         android:secondaryProgress="0"   
         />   

android:progressDrawable="@drawable/seekbar_style"背景條
seekbar_style配置如下:
Xml代碼
復制代碼 代碼如下:

<?xml version="1.0" encoding="UTF-8"?>   

<layer-list xmlns:android="http://schemas.android.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="#ff0099CC"   
                         android:centerColor="#ff3399CC"   
                         android:centerY="0.75"   
                         android:endColor="#ff6699CC"   
                         android:angle="270"   
                 />   
             </shape>   
         </clip>   
     </item>   

</layer-list>   

或者:用圖片如下:
Xml代碼
復制代碼 代碼如下:

<?xml version="1.0" encoding="utf-8"?>   
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">   

    <item android:id="@android:id/background"    
          android:drawable="@drawable/progress_bg" />   

    <item android:id="@android:id/secondaryProgress"   
          android:drawable="@drawable/second_progress">   
    </item>       

    <item android:id="@android:id/progress"   
          android:drawable="@drawable/first_progress">   

    </item>    
</layer-list>   

方形
Xml代碼
復制代碼 代碼如下:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">    
    <item android:id="@android:id/background"    
    android:drawable="@drawable/progress_bg" />    
    <item android:id="@android:id/secondaryProgress">    
     <clip android:drawable="@drawable/second_progress" />    
    </item>    
    <item android:id="@android:id/progress">    
         <clip android:drawable="@drawable/first_progress" />    
    </item>    
</layer-list>   

android:thumb="@drawable/thumb"就是那個會動的球
配置如下:
Xml代碼
復制代碼 代碼如下:

<?xml version="1.0" encoding="UTF-8"?>   
<selector xmlns:android="http://schemas.android.com/apk/res/android">         

    <!-- 按下狀態-->   
    <item    
        android:state_focused="true"    
        android:state_pressed="true"    
        android:drawable="@drawable/thumb_pressed" />         
    <!-- 普通無焦點狀態 -->   
    <item    
        android:state_focused="false"    
        android:state_pressed="false"   
        android:drawable="@drawable/thumb_normal" />               
    <!-- 有焦點狀態-->   
    <item    
        android:state_focused="true"    
        android:state_pressed="false"               
        android:drawable="@drawable/thumb_focused" />          
    <!-- 有焦點 -->   
    <item    
        android:state_focused="true"               
        android:drawable="@drawable/thumb_focused" />      
</selector> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 永吉县| 宝坻区| 陈巴尔虎旗| 稷山县| 思南县| 中牟县| 右玉县| 衡阳市| 中卫市| 福安市| 定安县| 雅安市| 贵定县| 德州市| 阿拉善盟| 和龙市| 新宁县| 福建省| 定襄县| 九江市| 偏关县| 万宁市| 宁夏| 紫金县| 响水县| 台前县| 宜黄县| 饶平县| 呼和浩特市| 资中县| 怀化市| 西安市| 湛江市| 自治县| 莱阳市| 综艺| 平谷区| 库伦旗| 汾西县| 丽江市| 孝义市|