#StackBounty: #android #android-layout #textview #android-database Formatting multine Text with bullet points from Database

Bounty: 100

I have a TextView where I display the Text from the database which can inclued bullet points:

Example Content

My TextView is inside a ScrollView with a LinearLayout and has nothing special:

       <TextView
            android:id="@+id/textview_quiz_infotext"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scrollbars="vertical"
            tools:text="- This is the text" />

When the text goes more than one line I want to add the same spacing like in the first line.
So it looks like this:

enter image description here

Is there a possibility to achieve this behavior?


Get this bounty!!!

#StackBounty: #android #textview Dynamic TextView that fill spaces if possible

Bounty: 50

In android we have constraints so we can put Views to start-of another Views and to end-of another Views

Specifically TextView when you set it’s end to start of another view it will be look like:-

Tex | Another View
tVi |
ew  |

Is there any layout to help me getting dynamic TextView for example the above one would be look like:-

Tex | Another View
tView | Parent device border

Here is a visual example:-

enter image description here


Get this bounty!!!

#StackBounty: #android #textview #font-size #android-fonts #android-chips Manually calculating available width is incorrect when displa…

Bounty: 50

I have a ViewGroup with a Chip as a child with no horizontal siblings.

I try to calculate the available width before choosing which text to set inside the Chip.

final View parent = (View) getParent();
final int parentPaddingLeft = parent.getPaddingLeft();
final int parentPaddingRight = parent.getPaddingRight();
final int paddingLeft = getPaddingLeft();
final int paddingRight = getPaddingRight();
final int leftMargin = layoutParams.leftMargin;
final int rightMargin = layoutParams.rightMargin;
final int textViewSafetyPadding = 20;
final int currentTextMaxWidth =
    parentWidth
        - (textViewSafetyPadding
            + parentPaddingLeft
            + parentPaddingRight
            + paddingLeft
            + paddingRight
            + leftMargin
            + rightMargin);

It all worked well, but when I change the OS display size and font size to the largest – I see the chosen text doesn’t fit inside the Chip.

Even though the paint measurement and chip actual width show it should fit.

Chip’s width onDraw == 550pxl
chosen text requires 442pxl

and

paint.measureText(chipText) <= textMaxWidth

Any idea of abnormal extra padding when font size and display size are bigger than default?


Get this bounty!!!