Text of TextView missing characters after rotation


Gerrit Homberg

I want to use a text view in my android layout which should be rotated 90 degrees to the left. The width of the text view is small (20dp). My code looks like this:

        <TextView
            android:id="@+id/txtVw"
            android:layout_width="wrap_content"
            android:layout_height="20dp"
            android:minWidth="20dp"
            android:maxWidth="20dp"
            android:paddingEnd="6dp"
            android:rotation="270"
            android:text="Test"/>

Rotation is done, but only those characters that are visible without rotation are shown - but there is enough space to show all characters. Does anyone have an idea?

Gerrit Homberg

I think this is indeed a bug, but I found a solution without my own custom TextView - if anyone else needs this, I'll post it:

    <TextView
        android:id="@+id/txtVwOne"
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:height="20dp"
        android:gravity="end"
        android:maxWidth="40dp"
        android:minWidth="40dp"
        android:rotation="270"
        android:text="Test" />

    <TextView
        android:id="@+id/txtVwTwo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="fill"
        android:layout_weight="1"
        android:layout_marginLeft="-20dp"
        android:minHeight="40dp" />

The trick is to set the min and max width to a value that will keep the text from being clipped horizontally. The layout height must be set to the desired height. The height property must be set to the target width of the text view. The following text view must be included android:layout_marginLeft="-20dp"to ensure it is moved 20 dp to the left (target position).

Related


Text of TextView missing characters after rotation

Gerrit Homberg I want to use a text view in my android layout which should be rotated 90 degrees to the left. The width of the text view is small (20dp). My code looks like this: <TextView android:id="@+id/txtVw" android:layout_

position of the text after rotation

Hamid When I rotate a span, the text in it doesn't align horizontally. You can see an example below. In this example, we have three spans that can be rotated, but there are issues with alignment. body{ padding-left:10px; } .bordered{ border-left: 2px sol

position of the text after rotation

Hamid When I rotate a span, the text in it doesn't align horizontally. You can see an example below. In this example, we have three spans that can be rotated, but there are issues with alignment. body{ padding-left:10px; } .bordered{ border-left: 2px sol

Missing TextView data (text) in fragment

Hassad Loya I have some edit text and text view in Fragment A. I use edit text to get the value from the user, then calculate and display the result in a text view based on my formula. For example Edittext A has 1 and Edittext B has 2 and my formula is added s

Rename special characters in column headers after rotation

PV8 Follow this thread: Renaming columns in pandas . I am going to use this line: df.columns = df.columns.str.replace('$','') The problem is that I rotated the dataframe df.pivot_table().to_records()and converted it to records and now my column headers have t

Rename special characters in column headers after rotation

PV8 Follow this thread: Renaming columns in pandas . I am going to use this line: df.columns = df.columns.str.replace('$','') The problem is that I rotated the dataframe df.pivot_table().to_records()and converted it to records and now my column headers have t

Rename special characters in column headers after rotation

PV8 Follow this thread: Renaming columns in pandas . I am going to use this line: df.columns = df.columns.str.replace('$','') The problem is that I rotated the dataframe df.pivot_table().to_records()and converted it to records and now my column headers have t

Android TextView text missing on Samsung devices

mk_ I have an app in play store. Some of my users report that they can't see the tabs. The problem seems to only happen on Samsung devices with Android 4.1 and below. I can't reproduce the problem on the emulator. Has anyone encountered such a thing? TextViews

Android TextView text missing on Samsung devices

mk_ I have an app in play store. Some of my users report that they can't see the tabs. The problem seems to only happen on Samsung devices with Android 4.1 and below. I can't reproduce the problem on the emulator. Has anyone encountered such a thing? TextViews

Android TextView text missing on Samsung devices

mk_ I have an app in play store. Some of my users report that they can't see the tabs. The problem seems to only happen on Samsung devices with Android 4.1 and below. I can't reproduce the problem on the emulator. Has anyone encountered such a thing? TextViews

Unicode characters are not the same size as text in TextView

Sworthy 46 I'm trying to display arrow unicode symbols in , TextViewbut for some reason the characters don't match the size of the text desite using the Html.fromHtmlcode . Is there any way to fix it? Activity layout <?xml version="1.0" encoding="utf-8"?> <and

Unicode characters are not the same size as text in TextView

Sworthy 46 I'm trying to display arrow unicode symbols in , TextViewbut for some reason the characters don't match the size of the text desite using the Html.fromHtmlcode . Is there any way to fix it? Activity layout <?xml version="1.0" encoding="utf-8"?> <and

Unicode characters are not the same size as text in TextView

Sworthy 46 I'm trying to display arrow unicode symbols in , TextViewbut for some reason the characters don't match the size of the text desite using the Html.fromHtmlcode . Is there any way to fix it? Activity layout <?xml version="1.0" encoding="utf-8"?> <and

How to set special characters as textview text

username I'm trying to set "@" as the text inside TextView, but since it @'s a reference key it won't allow me to set it as text. <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity=

Unicode characters are not the same size as text in TextView

Sworthy 46 I'm trying to display arrow unicode symbols in , TextViewbut for some reason the characters don't match the size of the text desite using the Html.fromHtmlcode . Is there any way to fix it? Activity layout <?xml version="1.0" encoding="utf-8"?> <and

Unicode characters are not the same size as text in TextView

Sworthy 46 I'm trying to display arrow unicode symbols in , TextViewbut for some reason the characters don't match the size of the text desite using the Html.fromHtmlcode . Is there any way to fix it? Activity layout <?xml version="1.0" encoding="utf-8"?> <and

Unicode characters are not the same size as text in TextView

Sworthy 46 I'm trying to display arrow unicode symbols in , TextViewbut for some reason the characters don't match the size of the text desite using the Html.fromHtmlcode . Is there any way to fix it? Activity layout <?xml version="1.0" encoding="utf-8"?> <and

How to set special characters as textview text

username I'm trying to set "@" as the text inside TextView, but since it @'s a reference key it won't allow me to set it as text. <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity=

Unicode characters are not the same size as text in TextView

Sworthy 46 I'm trying to display arrow unicode symbols in , TextViewbut for some reason the characters don't match the size of the text desite using the Html.fromHtmlcode . Is there any way to fix it? Activity layout <?xml version="1.0" encoding="utf-8"?> <and

Circle-centered text before and after rotation

Brad Anderson I found this out and thought it was cool. The problem is that I can't seem to center the text in the circle either before or after the rotation. The current colors don't matter because I changed them just to be able to see the difference when I m

Align UILabel text after rotation with autolayout constraints

Sonny Hills I'm trying to get a line of text to match the content when rotated, yes UILabel. Currently, at each UICollectionViewCellI set the label to be rotated 180 degrees. The label's text is left-aligned, but as shown in the attached image, this shouldn't

Align UILabel text after rotation with autolayout constraints

Sonny Hills I'm trying to get a line of text to match the content when rotated, yes UILabel. Currently, at each UICollectionViewCellI set the label to be rotated 180 degrees. The label's text is left-aligned, but as shown in the attached image, this shouldn't

Circle-centered text before and after rotation

Brad Anderson I found this out and thought it was cool. The problem is that I can't seem to center the text in the circle either before or after the rotation. The current colors don't matter because I changed them just to be able to see the difference when I m

Antialiased text in Firefox after CSS rotation

microphone So I've read a lot about the current state of rotated text and can't quite achieve true antialiasing in all browsers. It looks like the first box in the picture in chrome, but looks like the second jagged box in firefox. I tried the most popular fix

Circle-centered text before and after rotation

Brad Anderson I found this out and thought it was cool. The problem is that I can't seem to center the text in the circle either before or after the rotation. The current colors don't matter because I changed them just to be able to see the difference when I m

Circle-centered text before and after rotation

Brad Anderson I found this out and thought it was cool. The problem is that I can't seem to center the text in the circle either before or after the rotation. The current colors don't matter because I changed them just to be able to see the difference when I m

Writing text file with bat script: missing characters

Jack I am using a bat script to try and write a few lines to a text file. However, in one case, one of the characters I want to write is deleted. Here is the code: @echo off @echo san policy=onlineall> test.txt @echo select disk 1>> test.txt @echo online disk>

Add text after special characters

Le Guin I have a string of punctuation that I want to add &thinsp;after all symbols . For example, the following string: Hi there, how are you ? Ok/not_ok ! I would like it to look like this: Hi there,&thinsp; how are you ?&thinsp; Ok/&thinsp;not_&thinsp;ok !