Search code examples
androidxamarinxamarin.androidstylesseekbar

VS - Android - How to change seekbar style from yellow to original blue


I made the app background transparent and after that the seekbar style changed from original blue holo to yellow (see picture). Android emulator is set to 4.2.2

enter image description here

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.Transparent" parent="@android:style/Theme.Translucent">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>    
    <item name="android:backgroundDimEnabled">false</item>
    <item name="android:background">@android:color/transparent</item>
  </style>
</resources>

Main.axml seekbar style:

<SeekBar
    p1:layout_width="250dp"
    p1:layout_height="wrap_content"
    p1:id="@+id/seekbarLevel"
    p1:max="100"
    p1:layout_marginRight="10dp"
    p1:layout_marginLeft="10dp"
    p1:layout_gravity="center" />
  1. How to make seekbar use standard style?

  2. Is there a tutorial or something about formatting or styling seekbar and other controls? How to make other shapes and colors?


Solution

  • Add the Halo style back to your SeekBar:

    style="@android:style/Widget.Holo.SeekBar"
    

    enter image description here

    <SeekBar
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:id="@+id/seekbarLevel"
        android:max="100"
        android:layout_marginRight="10dp"
        android:layout_marginLeft="10dp"       
        android:layout_gravity="center" />
    <SeekBar
        android:layout_width="250dp"
        android:layout_height="wrap_content"
        android:id="@+id/seekbarLevel"
        android:max="100"
        android:layout_marginRight="10dp"
        android:layout_marginLeft="10dp"       
        android:layout_gravity="center" 
        style="@android:style/Widget.Holo.SeekBar" />