android seekBar默认的效果是圆角的,如果想实现非圆角的,可以试下下面这种方式:
首先布局文件的实现方式:
<?xml version=
"1.0"
encoding=
"utf-8"
?>
<LinearLayout xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"fill_parent"
android:layout_height=
"fill_parent"
android:orientation=
"vertical"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"50dip"
>
<ImageView
android:layout_width=
"fill_parent"
android:layout_height=
"26dip"
android:layout_centerVertical=
"true"
android:background=
"@drawable/seekbar_bg"
>
</ImageView>
<SeekBar
android:id=
"@+id/seekBar1"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"4dip"
android:layout_marginRight=
"4dip"
android:layout_marginTop=
"3dip"
android:max=
"100"
android:progress=
"75"
android:progressDrawable=
"@drawable/seekbar_img1"
android:thumb=
"@null"
/>
</RelativeLayout>
</LinearLayout
<item
android:id=
"@android:id/background"
android:drawable=
"@drawable/seek_color_drawable_bg_translucent_print"
>
<!--
<shape >
<corners android:radius=
"0dip"
/>
<gradient
android:angle=
"270"
android:centerColor=
"#84badc"
android:centerY=
"0.8"
android:endColor=
"#85badd"
android:startColor=
"#5b859e"
/>
</shape>
-->
</item>
<item android:id=
"@android:id/progress"
>
<clip >
<shape >
<corners android:radius=
"0dip"
/>
<gradient
android:angle=
"270"
android:centerColor=
"#5ea500"
android:centerY=
"0.75"
android:endColor=
"#a9eb2f"
android:startColor=
"#b4f43f"
/>
</shape>
</clip></item>
</layer-list>