I have a TextView
enclosed in a container like this:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="40dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:maxLines="1"
android:text="Hi World" />
</FrameLayout>
A width on the FrameLayout
of 40 dp is not quite enough to enclose the full line of text. I would therefore expect the TextView
to be clipped by its parent. Instead, the TextView
does not render the word "World" at all!
TextView
to be clipped instead? This is part of a width changing animation (container resized to 0dp width) where removing letters or chunks of text causes annoying flickering.This works as you expected
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:singleLine="true"
android:ellipsize="none"
android:maxLines="1"
android:text="Hi World" />
Also this
<TextView
android:layout_width="wrap_content"
android:layout_height="40dp"
android:inputType="text"
android:maxLines="1"
android:text="Hi World" />