F
F
feniksdv2020-02-03 08:43:20
Java
feniksdv, 2020-02-03 08:43:20

How to stick a line to the right edge?

Hello. How exactly in this way, without tables, without RelativeLayout, without rewriting the code, glue a line to the right of the screen. I need exactly this way, I believe that some parameter is needed, which I can't find anywhere =)

String a0 = String.format("%s", "✔ Австралийские подтягивания");
String a1 = String.format("%10s", " 10");
String a2 = String.format("%s", "✔ Приседание");
String a3 = String.format("%10s", " 10");
String a4 = String.format("%s", "✔ Отжимания на коленях");
String a5 = String.format("%10s", " 10");

karProitiTrenurovky1.setText(a0 + a1 + "\n" + a2 + a3 + "\n" + a4 + a5);
vivod_elementov.addView(karProitiTrenurovky1, lpView);


Here's what happens.
5e37b2106c42e357687182.png
and I want the numbers to be glued to the right edge. Like this => 5e37b28f255fb114178836.png

Why is this option with numbers not suitable ?! Because the screens are different, everything is OK on a small screen, not OK on a large one.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Korotenko, 2020-02-03
@feniksdv

The default string has length = Indented character length * number of characters.
This is an algorithm.
So rewrite the code.
option 1 add tabs not very good
option 2 add spaces not very good
option 3 add right-aligned grid 2 columns probably the best

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question