Android Question How to change color slide menu ?

Ajws

Member
Licensed User
Hi all,

i download project appcompat from forum.. i try to change color and done..

but when i scroll my slide menu to last item.. why my color changed ?


Help...

Regards
Ajws
 

Attachments

  • Screenshot_1502338972.png
    116.4 KB · Views: 399
  • Screenshot_1502339120.png
    149.1 KB · Views: 440

Erel

B4X founder
Staff member
Licensed User
Longtime User
Never reuse the same background drawable.

I recommend you to use CustomListView instead of ListView whenever you are showing less than 1000 items.
B4X:
  lftMenu.Background = CreateGD
   For i = 1 To 30
     ListView1.AddSingleLine("Item " & i)
     ListView1.SingleLineLayout.Label.TextSize=12
     ListView1.SingleLineLayout.Label.Background = CreateGD
     ListView1.TwoLinesLayout.Label.Background = CreateGD
     ListView1.TwoLinesLayout.SecondLabel.Background = CreateGD
     
   Next
   Dim jo As JavaObject = ACToolBarLight1
   Dim xl As XmlLayoutBuilder
   jo.RunMethod("setPopupTheme", Array(xl.GetResourceId("style", "ToolbarMenu")))
End Sub

Sub CreateGD As GradientDrawable
   Dim gd As GradientDrawable
   gd.Initialize("BOTTOM_TOP", Array As Int (Colors.rgb(103,58,183), Colors.rgb(103,58,183), Colors.rgb(103,58,183)))
   Return gd
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…