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

看板AndroidDev作者 (-.-)時間7年前 (2016/11/29 14:33), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
是這樣的我在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的初始位置.. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 60.250.82.82 ※ 文章網址: https://www.ptt.cc/bbs/AndroidDev/M.1480401187.A.490.html
文章代碼(AID): #1OFI4ZIG (AndroidDev)