androidapifastscroll

Conditional compilation of fastScrollThumbDrawable?


I have an app with min API 10, and I set fastScrollEnabled to true. Now, the fastScrollThumbDrawable is really horrible, and I want to change it. I can add in the style.xml the line

<item name="android:fastScrollThumbDrawable">@drawable/fastscroll_thumb</item>

The problem is that android:fastScrollThumbDrawable only works for API 11+, and API10 does not let me to compile with that line (eclipse). So I want to set android:fastScrollThumbDrawable programatically when API >= 11, otherwise stay with the horrible one.

The problem is that I couldn't find a way of setting android:fastScrollThumbDrawable programatically... Is this possible? Is there any way to circumvent this?

Thanks! L.


Solution

  • In your res folder create a folder called values-v11.

    Inside this folder create a file called style.xml

    This file will be specific to API level 11 and above.