KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have this TextView . Some parts of it is supposed to be aligned to the left and some parts to the right. How would I do this in Java? Basicly I want the first line to align to the left, and the next line to the right and so on. Anyone got a clue? EDIT I have tried to use HTML and then when that did not work I tried spans. html attempt textView.setText(Html.fromHtml("<p align=\"right\">THIS IS TO THE RIGHT</p>")); And heres the span attempt String LeftText = "LEFT"; String RightText = "RIGHT"; final String resultText = LeftText + " " + RightText; final SpannableString styledResultText = new SpannableString(resultText); styledResultText.setSpan(new AlignmentSpan.Standard(Alignment.ALIGN_OPPOSITE), LeftText.length() + 1, LeftText.length() + 2 +RightText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); textView.setText(styledResultText); But none of them seems to work.
Tags (comma-separated)
Save Edits
Cancel