Sir please i'm working on an app in B4A using Sqlite db browser, I want to make some text bold and color changed in the app. The text description is loaded from the database and i use label layout in b4A designer to display it, how do i do it?
Below are some code in my project. And the pictures are the result of the app the annotated part are where i want the effect to take place please help
Below are some code in my project. And the pictures are the result of the app the annotated part are where i want the effect to take place please help
B4X:
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region
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.
Private ListView1 As ListView
Dim cur As Cursor
Dim xui As XUI
Private ImageView1 As ImageView
Private Label1 As Label
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("CntList")
Dim lblList As Label
lblList = ListView1.SingleLineLayout.Label
lblList.TextColor= Colors.Black
lblList.TextSize = 18
cur = Starter.SQL1.ExecQuery("select * from content")
cur.Position = 0
For i = 0 To cur.RowCount -1
cur.Position = i
ListView1.AddSingleLine(cur.GetString("Title"))
Next
cur.Close
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub ImageView1_Click
StartActivity("HomeScreen")
Activity.Finish
End Sub
Private Sub imgBack_Click
StartActivity("HomeScreen")
Activity.Finish
End Sub
Private Sub ListView1_ItemClick (Position As Int, Value As Object)
Starter.Title = Value
ToastMessageShow(Starter.Title, False)
StartActivity("HbDiscription")
End Sub
B4X:
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region
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 dCursor As Cursor
Private Desc_ScrollView As ScrollView
Private descLabel As Label
Private ImageView1 As ImageView
Private Labelhead As Label
Dim strUtils As StringUtils
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("DescriptionLay")
Desc_ScrollView.Panel.LoadLayout("DescriptionLblLyt")
dCursor = Starter.SQL1.ExecQuery("SELECT * FROM messages WHERE Title = '" & Starter.Title & "' ")
dCursor.Position = 0
For i = 0 To dCursor.RowCount -1
dCursor.Position = i
Labelhead.Text = dCursor.GetString("Title")
descLabel.Text = dCursor.GetString("Body")
descLabel.Height = strUtils.MeasureMultilineTextHeight(descLabel, descLabel.Text)
Desc_ScrollView.Panel.Height = descLabel.Height
Next
dCursor.Close
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Private Sub ImageView1_Click
StartActivity("ContentListV")
Activity.Finish
End Sub