Skip to content

Odd layout with gravity="center" and ellipsize="end" #29

Description

@aohrem

When using the ExpandableTextView with the attributes gravity="center" to center the text in combination with ellipsize="end", the collapsed layout of the last line is a bit off.

Collapsed state:

screenshot_1546085997

Expanded state:

screenshot_1546085995

<LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:orientation="vertical">

     <at.blogc.android.views.ExpandableTextView
         android:id="@+id/textViewDescription"
         style="@style/BodyNormal"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center"
         android:ellipsize="end"
         android:lineSpacingExtra="2sp"
         android:maxLines="3"
         android:textColor="@color/blackAlpha87"
         app:animation_duration="500"
         tools:text="A look at the life of the astronaut, Neil Armstrong, and the legendary space mission that led him to become the first man to ..."/>

      <Button
         android:id="@+id/buttonViewMore"
         style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_horizontal"
         android:text="@string/view_more"
         android:textAppearance="@style/Button"
         android:textColor="?android:attr/colorPrimary"/>
</LinearLayout>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions