Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to set arrow on custom seekbar ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 2.08k
    Comment on it

    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.

    1. <?xml version="1.0" encoding="utf-8"?>
    2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    3. android:orientation="vertical" android:layout_width="match_parent"
    4. android:layout_height="match_parent">
    5. <TextView
    6. android:id="@+id/tvValue"
    7. android:layout_width="match_parent"
    8. android:layout_height="wrap_content"
    9. android:layout_marginTop="5dp"
    10. android:gravity="center"
    11. android:text="0/100"
    12. android:textSize="22sp"
    13. android:textStyle="bold" />
    14.  
    15.  
    16. <FrameLayout
    17. android:layout_width="match_parent"
    18. android:layout_height="wrap_content"
    19. android:layout_marginBottom="5sp"
    20. android:orientation="vertical">
    21.  
    22.  
    23. <ImageView
    24. android:id="@+id/imgScale"
    25. android:layout_width="match_parent"
    26. android:layout_height="wrap_content"
    27. android:layout_marginTop="20dp"
    28. android:background="@drawable/scale" />
    29.  
    30. <SeekBar
    31. android:id="@+id/seekBarScale"
    32. android:layout_width="match_parent"
    33. android:layout_height="30dp"
    34. android:layout_alignParentLeft="true"
    35. android:layout_centerVertical="true"
    36. android:layout_marginTop="10dp"
    37. android:max="100"
    38. android:progressDrawable="@android:color/transparent"
    39. android:thumb="@drawable/white_arrow_down"
    40. android:thumbOffset="15dp" />
    41.  
    42.  
    43. </FrameLayout>
    44.  
    45. <RelativeLayout
    46. android:layout_width="match_parent"
    47. android:layout_height="wrap_content"
    48. android:layout_marginBottom="10sp"
    49. android:orientation="horizontal">
    50.  
    51. <TextView
    52. android:layout_width="wrap_content"
    53. android:layout_height="wrap_content"
    54. android:layout_alignParentLeft="true"
    55. android:text="@string/poor_txt"
    56. android:textSize="8sp"
    57. android:textStyle="bold" />
    58.  
    59. <TextView
    60. android:layout_width="wrap_content"
    61. android:layout_height="wrap_content"
    62. android:layout_alignParentRight="true"
    63. android:text="@string/excellent_txt"
    64. android:textSize="8sp"
    65. android:textStyle="bold" />
    66. </RelativeLayout>
    67. </LinearLayout>

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: