Android Question UltimateListView: how to set color on selecting

Paolo Trevisiol

Member
Licensed User
Hi all!
I'm using UltimateListView (by Informatix).
The question is: how to set the color that appear on "tap" event ...
I'm able to set color creating items list (light blue) , I'm able to set color on selected items (deep blue) ... but i'm not able to set color used when my finger touch and doesn't release an item (it's orange).
Could someone help me?
Thanks!
 

Dave O

Well-Known Member
Licensed User
Longtime User
ULV is a great library and many of my apps depend on it, very solid code.

Good question about the tap colour. I don't think there's a direct way to set this colour, though it may be controlled by the SetStyle call, which takes a theme as the argument.

In my apps, the tap colour is medium gray, and that's from using SetStyle with STYLE_HOLO_DARK and STYLE_HOLO_LIGHT (for dark mode and light mode respectively).

The complication here is that I've also defined custom elements for those, using this manifest code:

B4X:
SetApplicationAttribute(android:theme, "@style/MyDarkTheme")
CreateResource(values-v20, theme.xml,
<resources>
    <style name="MyDarkTheme" parent="@android:style/Theme.Material">
        <item name="android:colorBackground">#FF303030</item> <!-- ~ -->
        <item name="android:colorPrimary">#146414</item> <!-- action bar -->
        <item name="android:colorPrimaryDark">#096E00</item> <!-- status bar -->
        <item name="android:colorSecondary">#7F003E</item> <!-- ~ -->
        <item name="android:colorAccent">#146414</item> <!-- checkboxes,, switches,, msgbox buttons in Android 6.x -->
        <item name="android:textColor">#8C8C8C</item> <!-- ? -->
         <item name="android:textColorPrimary">#8C8C8C</item> <!-- msgbox text in Android 6.x -->
        <item name="android:textColorSecondary">#606060</item> <!-- inactive editText line,, scrollbar -->
        <item name="android:textColorLink">#146414</item>
        <item name="android:textColorHighlight">#146414</item> <!-- menu text,, msgbox title -->
        <item name="android:windowTranslucentStatus">false</item>
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">#FF000000</item>
        <item name="android:navigationBarColor">#FF202020</item>
    </style>
    <style name="MyLightTheme" parent="@android:style/Theme.Material.Light">
        <item name="android:colorBackground">#FFFFFF</item> <!-- ~ -->
        <item name="android:colorPrimary">#2BB22B</item> <!-- action bar -->
        <item name="android:colorPrimaryDark">#096E00</item> <!-- status bar -->
        <item name="android:colorSecondary">#CC0065</item> <!-- ~ -->
        <item name="android:colorAccent">#146414</item> <!-- checkboxes,, switches,, msgbox buttons in Android 6.x -->
        <item name="android:textColor">#000000</item> <!-- ? -->
         <item name="android:textColorPrimary">#000000</item> <!-- msgbox text in Android 6.x -->
        <item name="android:textColorSecondary">#606060</item> <!-- inactive editText line,, scrollbar -->
        <item name="android:textColorLink">#2BB22B</item>
        <item name="android:textColorHighlight">#2BB22B</item> <!-- menu text,, msgbox title -->
    </style>
</resources>
)

I haven't had time to figure out which of these elements (if any) is used for the tap color in ULV, but perhaps start with a standard SetStyle theme and go from there.

Hope this helps!
 
Upvote 0
Top