android SeekBar使用

main.xml为:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <SeekBar android:id="@+id/mPlayMusicVolume"
				android:layout_width="fill_parent" android:layout_height="wrap_content"
				android:layout_gravity="center" android:progressDrawable="@drawable/play_volume_style"
				android:thumb="@drawable/play_thumb_style" android:layout_centerVertical="true"  
				android:thumbOffset="0dip" android:paddingTop="10dip"
				android:paddingLeft="-10dip" android:paddingRight="-5dip"
				android:minHeight="19dip" android:maxHeight="19dip"
				android:layout_marginLeft="25dip" android:layout_marginRight="25dip" 
			/>
</LinearLayout>

play_thumb_sytle.xml为:

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">     
 	<item      
        android:state_pressed="true"   
        android:drawable="@drawable/play_progress_scroll_selected"     
        />          
    <!-- 普通无焦点状态 -->   
    <item      
        android:state_focused="false"      
        android:state_pressed="false"    
        android:drawable="@drawable/play_progress_scroll_normal"  
    	/>  
</selector>

play_volume_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"   
          android:drawable="@drawable/play_volume_total" />  
        
    <item android:id="@android:id/secondaryProgress"  
          android:drawable="@drawable/play_volume_total">  
    </item>      
       
    <item android:id="@android:id/progress"  
          android:drawable="@drawable/play_volume_played">  
    </item>   
</layer-list>  

其中play_volume_total为未播放时的进度条图片,play_volume_played为已经播放过去的进度条图片

你可能感兴趣的:(android SeekBar使用)