this is a screen shot from my android. the text is "asd". however the "d" is slightly cut off. here is the relevant view:
<TextView
android:id="@+id/stuff"
android:padding="2dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/other_stuff"
android:layout_marginTop="33dp"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="italic" />
any idea as to what is causing this ?
Android: How to Cut, Copy, and Paste TextTap and hold your finger on the text box you are copying text from for about 2 seconds until a menu appears at the top of the screen and the text becomes highlighted. Drag the selection to highlight the exact text you wish to work with. Select the “Cut” or “Copy” icon option.
you can extend the TextView class and overwrite the setText() function. In this function you check for text length or word cound. Better than counting the text length or the word cound a better way would be to use the "maxLines" attribute along with "ellipsize" attribute to attain the desired effect.
To use preset sizes to set up the autosizing of TextView in XML, use the android namespace and set the following attributes: Set the autoSizeText attribute to either none or uniform. none is a default value and uniform lets TextView scale uniformly on horizontal and vertical axes.
ended up with a hacky solution which is adding a white space after the last italicized character
Ok this is pretty strange but I changed from android:maxLines="1"
to android:singleLine="true"
and now the text is not getting cut off.
This is caused by Android setting the TextView
clipping rectangle for standard text and you using italic text. Italic text leans to the right, outside of the text bounds. For some reason Android does not account for this.
To prevent this, you can force a TextView
to draw outside of its bounds by giving it a text shadow. If you set the shadow color to transparent, the result is simply un-clipped text. Add these to your TextView
:
android:shadowColor="#00FFFFFF"
android:shadowDx="48"
android:shadowDy="0"
android:shadowRadius="1"
Also, if this doesn't work, try setting android:clipChildren=false
on the parent layout.
I fixed it with setting the width of TextView to fill_parent instead of wrap_content...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With