I am just wondering if it is possible to customize the look and feel of the spinner view?
I have experimented with the following code and noted I can set the spinner background (using a ninepatch image).
B4X:
Sub SetNinePatchDrawable(Control As View, ImageName As String)
Dim r As Reflector
Dim package As String
Dim id As Int
package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
id = r.GetStaticField(package & ".R$drawable", ImageName)
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
Control.Background = r.RunMethod2("getDrawable", id, "java.lang.int")
End Sub
If possible, I would also like to change the Selector-image and also the background color of the list shown (I think it is called PopUpBackground). Is this possible? If yes, may I kindly ask for a code-example.
Here are some links I found which deal with customizing a spinner. It seems that various XML-files are involved. http://www.gersic.com/blog.php?id=57
I've found it is actually better and easier to make one yourself using a label. I've made a few libraries that do this. My most recent is LineLayout. It can also pull from the resources and draw like a standard Spinner. The big gain is proper text size since Spinner controls don't size well.
Thank you Roger for your LineLayout-library. I started playing around with it and it seems it might just do what I want and in addition it includes some other nice goodies. Nice library Roger. Thanks!
However, I am still interested in knowing how to replicate what mentioned in the links in my first post using B4A (if it is possible).