Bug? AutoCompleteEditText shows black filled rectangle in Android 5

Inman

Well-Known Member
Licensed User
Longtime User
In Android 5 (both emulator and device) when AutoCompleteEditText displays the dropdownlist for suggestions, a black box surrounds it, as shown in the screenshot. This exists only on Android 5.0.

I am also attaching a small sample project and APK for you to try. Make sure you test on an Android 5.0 device or emulator. The code is as shown below.

Please let me know how to fix this.

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim ae As AutoCompleteEditText
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Dim jo As JavaObject
    Dim bg As ColorDrawable
    bg.Initialize(0xfff3f3f3,0)
    ae.Initialize("")
    ae.TextColor=Colors.Black
    ae.SetItems2(Array As String("aaaa","bbbb","cccc"),ae.Typeface,Gravity.LEFT,ae.TextSize,Colors.Black)
    Activity.AddView(ae,15dip,30dip,100%x-30dip,60dip)
    ae.RequestFocus
       
    jo=ae
    jo.RunMethod("setDropDownBackgroundDrawable",Array As Object(bg))
End Sub
 

Attachments

  • AEbug.jpg
    AEbug.jpg
    5.2 KB · Views: 201
  • autocompletetest.zip
    6.4 KB · Views: 175
  • AutoComplete.apk
    107.6 KB · Views: 170

Inman

Well-Known Member
Licensed User
Longtime User
It does work, yes, but the dropdown background is always black, even if the theme is Holo Light. This issue is there with all versions of Android, which forced me to use setDropDownBackgroundDrawable in the first place.
 

Attachments

  • AEbug2.jpg
    AEbug2.jpg
    4.9 KB · Views: 211
Top