The Android toolbar displays the end of the title
•
Android
I have an application where users can learn more about the structure and want to display it in the toolbar, such as 1 > 2 > 3 > 4
But when the toolbar is too long, the end will be truncated. How can I start from scratch, so the end is always displayed? I tried to search, but I couldn't find anything
resolvent:
You can use the Android: ellipsize property to change how text is truncated in textview. Android: ellipsize = "start" is the value you seem to be looking for
To do this in the toolbar, simply replace the title with your own textview, as follows:
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
<TextView android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textSize="20sp"
android:maxLines="1"
android:ellipsize="start"/>
</android.support.v7.widget.Toolbar>
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码