您的位置:首页 > 其它

改变seekbar的游标图片大小

2014-05-06 15:37 253 查看
url:

http://stackoverflow.com/questions/9699951/changing-size-of-seekbar-thumb

The most flexible way to set thumb size for me is to create layered-drawable with shape as placeholder
thumb_image.xml
:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<size
android:height="40dp"
android:width="40dp" />
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:drawable="@drawable/scrubber_control_normal_holo"/>
</layer-list>


So basically changing the size of shape will stretch drawable, the shape is transparent so it won't be visible. Also the minimum size of such thumb is size of bitmap.

Here is example of layout:

<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumb="@drawable/thumb_image" />

<SeekBar
android:id="@+id/seekBar2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: