TwoLinesAndBitmap - How to change property of SecondLabel

juergen_pool

Member
Licensed User
Longtime User
Hi,

how can i change a property of the second line (ScondLabel) in a ListView with TwoLinesWithBitmap?

Changing TwoLinesLayout.SecondLabel... makes nothing?
 

klaus

Expert
Licensed User
Longtime User
What do you want to do ?
For example following lines work:
B4X:
[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]lsvList.TwoLinesLayout.SecondLabel.TextColor=[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Colors[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].Red[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]lsvList.TwoLinesLayout.SecondLabel.Left=20[/SIZE][/FONT][/SIZE][/FONT]
These changes are valid for ALL second labels.
You can not change individual labels.


Best regards.
 
Upvote 0

juergen_pool

Member
Licensed User
Longtime User
Hallo Klaus,

genau das mache ich (TextSize und TextColor setzen). Das funktioniert einwandfrei bei TwoLines, hat aber bei TwoLinesAndBitmap keine Auswirkung (bei mir).

Grüß

Jürgen
 
Upvote 0

CidTek

Active Member
Licensed User
Longtime User
Hi,

how can i change a property of the second line (ScondLabel) in a ListView with TwoLinesWithBitmap?

Changing TwoLinesLayout.SecondLabel... makes nothing?


Which one is it you are trying to change?

TwoLinesWithBitmap.SecondLabel is not the same same as TwoLinesLayout.SecondLabel so make sure you are keeping track of which oblject you are using.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
You must set these parameters before adding the items.
Afterwards you cannot change these parameters anymore.

Du musst die Parameter setzten bevor Du die Einträge einfügst.
Nachher kann man sie nicht mehr ändern.

Best regards.
 
Upvote 0

juergen_pool

Member
Licensed User
Longtime User
Hallo Klaus,

Sorry, wenn ich mich hier noch etwas ungeschickt benehme, dass geht bestimmt auch eleganter. Ich setze die Properties, bevor ich die Elemente hinzufüge. Hier mal der komplette Source:

Sub Activity_Create(FirstTime As Boolean)

If FirstTime Then
File.Copy(File.DirAssets,"0015.jpg", File.DirRootExternal&"/sdcard","cover.jpg")
List1 = File.ReadList(File.DirRootExternal&"/sdcard", "mp3liste.txt")
cover.InitializeSample(File.DirRootExternal&"/sdcard", "cover.jpg",50,50)
End If
ListView1.Initialize("ListView1")
SubView.Initialize("SubView")
Search.Initialize("Search")

Log("Init")
ListView1.FastScrollEnabled = True
ListView1.TwoLinesLayout.SecondLabel.TextSize = 20
ListView1.TwoLinesLayout.SecondLabel.TextColor = Colors.Yellow

Search.Text="Suche"

Log("LV Config")
For i = 0 To List1.Size-1
s=List1.Get(i)
ListView1.AddTwoLinesAndBitmap(s.SubString2(0,29), s.SubString2(30,59),cover) <-- Funktioniert nicht
'ListView1.AddTwoLines(s.SubString2(0,29), s.SubString2(30,59)) <-- Funktioniert
Next
Log("AddLines")
Activity.AddView(ListView1, 0, 0, 100%x, 80%y)
Activity.AddView(Search,0,100%y - 50,80,40)
Log("Add View")
End Sub


Nachtrag: Die AddTwoLines... funktionieren natürlich, aber in der ListView wird die zweite Zeile bei der Bitmap-Variante NICHT mit den geänderten Attributen dargestellt, sondern nur "kleine, graue Schrift"!
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
Longtime User
As CidTek already suggested, you must change:
Wie CidTek es schon vorgeschlagen hat, musst Du folgendes ändern:
B4X:
ListView1.TwoLinesLayout.SecondLabel.TextSize = 20
ListView1.TwoLinesLayout.SecondLabel.TextColor = Colors.Yellow
to
B4X:
ListView1.TwoLinesWithBitmap.SecondLabel.TextSize = 20
ListView1.TwoLinesWithBitmap.SecondLabel.TextColor = Colors.Yellow

Best regards.
 
Upvote 0

juergen_pool

Member
Licensed User
Longtime User
Thanks / Danke

Thanks to all / Danke an alle.

Now it works / nun geht es!

I have tried .TwoLinesAndBitmapLayout -> doesn't exist, so i assume it works with TwoLinesLayout.

Ich hatte es mit TwoLinesAndBitmapLayout versucht, weil mir das die logische Fortsetzung von SingleLineLayout und TwoLinesLayout erschien, mein Fehler. Wer lesen und schreiben kann, ist deutlich im Vorteil:D
 
Upvote 0
Top