[問題] 自製SeekBar進度條顯示問題

作者: gene07 (-.-)   2016-11-29 14:33:03
是這樣的我在layout.xml中seekbar的progressdrawable中設置一個特定的顏色如下
<item android:id="@android:id/progress" >
<clip android:clipOrientation="horizontal" android:gravity="left" >
<inset
android:insetBottom="5px"
android:insetTop="5px">
<shape>
<gradient
android:startColor="#303F9F"
android:centerColor="#00EC00"
android:centerX="0.5"
android:endColor="#BB3D00"
android:angle="0"
/>
</shape>
</inset>
</clip>
</item>
而在MainActivity我可能會動態修改到inset的位置
所以我寫了
InsetDrawable ID = new InsetDrawable(getDrawable(R.drawable.choose),0,3,0,3);
之後把ID放到seekbar.setProgressDrawable(ID);
把apk安裝到手機後我看seekbar的progress那列都沒有顯示我需要的顏色。
只有用手去拉thumb才會出現我所設定的東西...
想請問是為什麼...
我在.xml中也有設定progress的初始位置..

Links booklink

Contact Us: admin [ a t ] ucptt.com