Manabu-GT / ExpandableTextView

Android's TextView that can expand/collapse like the Google Play's app description
Apache License 2.0
4.08k stars 791 forks source link

MaxLines on expanded TextView? #71

Open c0dehunter opened 4 years ago

c0dehunter commented 4 years ago

I want to limit max lines when textview is expanded. But it seems it's not working?

<com.ms.square.android.expandabletextview.ExpandableTextView
                xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
                android:id="@+id/post_content"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/news_title_bg_color"
                android:paddingStart="4dp"
                android:paddingEnd="4dp"
                expandableTextView:maxCollapsedLines="2"
                expandableTextView:animDuration="200">
                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:gravity="center_vertical"
                    android:orientation="horizontal">
                    <TextView
                        android:id="@id/expandable_text"
                        android:layout_width="0dp"
                        android:layout_weight="1"
                        android:maxLines="5"
                        android:layout_height="wrap_content"
                        android:textSize="12sp"
                        android:textColor="@color/colorDarkWhiteText"
                        android:textStyle="bold"/>
                    <ImageButton
                        android:id="@id/expand_collapse"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:padding="2dp"
                        android:tint="@color/colorDarkWhiteText"
                        android:layout_gravity="center_vertical"
                        android:background="@android:color/transparent"/>
                </LinearLayout>
            </com.ms.square.android.expandabletextview.ExpandableTextView>