Android Question Problems with AutoCompleteEditText colors

falbertini

Member
Licensed User
Longtime User
Hello,
I am trying to use AutoCompleteEditText but the colors seems not correct.
I use Holo.Light theme ( SetApplicationAttribute(android:theme, "@android:style/Theme.Holo.Light") ) and I simply add an AutoCompleteEditText. But the color of the text is gray and the popup where the user can choose the item has background black.

AutoCompleteEditText.png


With spinner and other controls everything works well.

spinner.png


I've tried changing Color and TextColor but it changes the style of the edit text, not the back color of the popup when the user clicks.
How can I set the background of the popup white ?
Attached you can find a sample to reproduce the problem
 

Attachments

  • test.zip
    3.4 KB · Views: 262

Erel

B4X founder
Staff member
Licensed User
Longtime User
A better way to set a light theme:
B4X:
SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values-v20, theme.xml,
<resources>
  <style
  name="LightTheme" parent="@android:style/Theme.Material.Light">
  </style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
  <style
  name="LightTheme" parent="@android:style/Theme.Holo.Light">
  </style>
</resources>
)

Add the control with the designer and it will look properly.

Note that SearchView is a more powerful alternative to AutoCompleteEditText.
 
Upvote 0

falbertini

Member
Licensed User
Longtime User
Thanks, I've tried setting the light theme in that way but it does not change.
Adding the control with designer look well, but in my application I need to add it at runtime because the form is dinamically created
How can I solve it when creating the control at run time?
 
Upvote 0

falbertini

Member
Licensed User
Longtime User
I am trying to use SearchView, but in the example is added in the designer.
I need to add it at run time, I've tried but does not work. How can I add it at run time ?
 
Upvote 0

falbertini

Member
Licensed User
Longtime User
Thanks, but the form is dinamically created based on a table that defines the fields to show.
The form can load for example five AutoCompleteEditText and many other controls; another time the same form can have a different set of controls, all dinamically generated.
If I create a layout file with only AutoCompleteEditText, but I need to create N of them with a name that I choose at run time, how can I use that layout file ?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
If I create a layout file with only AutoCompleteEditText, but I need to create N of them with a name that I choose at run time, how can I use that layout file ?
It is not a problem. The global variable (AutoCompleteEditText1 for example) will point to the last loaded view.

So you can do something like:
B4X:
Panel1.LoadLayout("ACT")
ACT1 = AutoCompleteEditText1 
Panel1.LoadLayout("ACT")
ACT2 = AutoCompleteEditText1 
...
 
Upvote 0
Top