HorizontalPicker
HorizontalPicker copied to clipboard
Maybe make it easier to style selected item (i.e. color and size)
it'd be cool to have methods to set the color and size of the selected item
Was looking for something with that capability. It would be really good to have.
Color can already be set through textColor
parameter. Selected state is for the middle item.
Test size for selected item is a bit trickier since the view would have to calculate text size on every frame. That could cause some performance issue.
Can you please elaborate on how we can achieve that? Thank you!
Hello fellow coders! If anyone has implemented this enhancement, Please help me. Thanks!
Can you please elaborate on how we can achieve that?
this works.. create an xml file like this one: number_selector.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimary" android:state_pressed="true"/>
<item android:color="@color/colorPrimary" android:state_selected="true"/>
<item android:color="@color/gray_1E1E1E"/>
</selector>
and then use it:
<com.wefika.horizontalpicker.HorizontalPicker
...
android:textColor="@drawable/number_selector"
btw - I also wish the text size and/or style could be changed for the selected item.. not sure how hard that'd be to implement