over 8 years ago
we can set arrow based seekbar using following trick like this : First of all you have to set a image of scale then below that image set a seekbar with progressDrawable transparent and then set arrow image as a thumb.
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="match_parent"
- android:layout_height="match_parent">
- <TextView
- android:id="@+id/tvValue"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="5dp"
- android:gravity="center"
- android:text="0/100"
- android:textSize="22sp"
- android:textStyle="bold" />
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="5sp"
- android:orientation="vertical">
- <ImageView
- android:id="@+id/imgScale"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dp"
- android:background="@drawable/scale" />
- <SeekBar
- android:id="@+id/seekBarScale"
- android:layout_width="match_parent"
- android:layout_height="30dp"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- android:layout_marginTop="10dp"
- android:max="100"
- android:progressDrawable="@android:color/transparent"
- android:thumb="@drawable/white_arrow_down"
- android:thumbOffset="15dp" />
- </FrameLayout>
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginBottom="10sp"
- android:orientation="horizontal">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:text="@string/poor_txt"
- android:textSize="8sp"
- android:textStyle="bold" />
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:text="@string/excellent_txt"
- android:textSize="8sp"
- android:textStyle="bold" />
- </RelativeLayout>
- </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/tvValue" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" android:gravity="center" android:text="0/100" android:textSize="22sp" android:textStyle="bold" /> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="5sp" android:orientation="vertical"> <ImageView android:id="@+id/imgScale" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/scale" /> <SeekBar android:id="@+id/seekBarScale" android:layout_width="match_parent" android:layout_height="30dp" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:layout_marginTop="10dp" android:max="100" android:progressDrawable="@android:color/transparent" android:thumb="@drawable/white_arrow_down" android:thumbOffset="15dp" /> </FrameLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="10sp" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:text="@string/poor_txt" android:textSize="8sp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="@string/excellent_txt" android:textSize="8sp" android:textStyle="bold" /> </RelativeLayout> </LinearLayout>
0 Comment(s)