开发者

Seekbar length manipulation

I'm using a seekb开发者_运维知识库ar in my android application to set the volume. However the length of the seekbar is unesthetically too short. So is there a way to customize the length of a seek bar ?


XML example:

<?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"
android:padding="10dip">
<SeekBar android:id="@+id/default_width_seek_bar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
<SeekBar android:id="@+id/fixed_width_seek_bar"
    android:layout_width="100dip"
    android:layout_height="wrap_content" />
<SeekBar android:id="@+id/full_width_seek_bar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
<SeekBar android:id="@+id/padded_full_width_seek_bar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="8dip" android:paddingRight="8dip" />
</LinearLayout>

Side note: The thumb of the SeekBar can be clipped when moved all the way to the sides. A little extra padding like in the last SeekBar fixes this problem.


SeekBar sk =(SeekBar)findViewById(R.id.seekbar);
sk.setLayoutParams(params)

Using this you can set the the length of the seekbar

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜