# Android QuestionLabel with hanging indents?

#### jo1234

##### Member
Hi,

I would like to show stepwise instructions with hanging indents in a multiline label.
Something like:
1.) First do text text text,
text text text​
2.) Then text text text text
text text text

The text is translated and differs in length between the different languages.

Is there a way to use SpannableString and android.text.style.LeadingMarginSpan in a label to get this done?

Thanks,
Johannes

Last edited:

#### Erel

Staff member
Can you post a picture of the layout you are trying to create?

#### jo1234

##### Member
Thanks, I have added an image.

#### KMatle

##### Expert
You could use a scrollview and add single labels (or use some libs here which create lists)

#### Erel

Staff member
B4X:
``````Sub Activity_Create(FirstTime As Boolean)
Sleep(0)
Dim cs As CSBuilder
cs.Initialize
cs.Append("1) First do text text text, text text text text text text text").PopAll
cs.Append(CRLF).Append("2) Second do text text text, text text text text text text text").PopAll
Label1.Text = cs
End Sub

Dim span As JavaObject
Dim jo As JavaObject = cs
jo.RunMethod("open", Array(span))
End Sub``````

You must use CallSub to call AddLeadingMarginSpan due to the way CSBuilder is implemented. The Sleep(0) is required if you want to call it from Activity_Create as otherwise the CallSub will be ignored (the activity is considered paused at that point).

Replies
24
Views
614
Replies
3
Views
280
Replies
162
Views
42K
Replies
92
Views
116K
Replies
2
Views
965