How can i change text color in listview when using singlelinelayout?
I found this on forum but is for button i need it for listview
I have set selector:
I found this on forum but is for button i need it for listview
B4X:
'Pass the Button object and Colors int values to set for each state.Sub SetColorStateList(Btn AsButton,Pressed As Int,Enabled As Int,Disabled As Int)
Dim States(3,1) As Int
States(0,0) = 16842919'Pressed States(1,0) = 16842910'Enabled States(2,0) = -16842910'DisabledDim Color(3) As Int = ArrayAs Int(Pressed,Enabled,Disabled)
Dim CSL AsJavaObject
CSL.InitializeNewInstance("android.content.res.ColorStateList",ArrayAs Object(States,Color))Dim B1 AsJavaObject = Btn
B1.RunMethod("setTextColor",ArrayAs Object(CSL))End Sub
I have set selector:
B4X:
bmp.Initialize(File.DirAssets, "back.png")
Dim CDPressed,CDNormal As BitmapDrawable
CDNormal.Initialize(bmp)
CDPressed.Initialize(bmp)
Dim SLD As StateListDrawable
SLD.Initialize
SLD.AddState(SLD.State_Pressed,CDPressed)
SLD.AddState(-SLD.State_Pressed,CDNormal)
Dim LVO As JavaObject = ListView1
LVO.RunMethod("setSelector",Array As Object(SLD))