ExpandableTextView
ExpandableTextView copied to clipboard
Not Compatible with AndroidX (Empty screen)
The following sample code provided doesn't output anything on the screen or the studio live preview.
Versions:
- expandableTextView:0.1.4
- gradle:3.5.0
<com.ms.square.android.expandabletextview.ExpandableTextView xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
android:id="@+id/expand_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
expandableTextView:maxCollapsedLines="4"
expandableTextView:animDuration="200">
<TextView
android:id="@id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textSize="16sp"
android:text="asdkjbaskjda\nsadasdasdas\nasdasdasdasd\nasdasdasdas\nasdas\nadsas\nadsas"
android:textColor="#666666" />
<ImageButton
android:id="@id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:layout_gravity="end|bottom"
android:background="@android:color/transparent" />
</com.ms.square.android.expandabletextview.ExpandableTextView>
I think you have to set the text in code. I'm using AndroidX and this library and I do have output in the emulator/device screen. No live preview though as you pointed out.
_expandableTextView?.text = getString(R.string.tos_1)
<com.ms.square.android.expandabletextview.ExpandableTextView
android:id="@+id/_expandableTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
expandableTextView:animAlphaStart="1"
expandableTextView:animDuration="300"
expandableTextView:maxCollapsedLines="2">
<LinearLayout
android:layout_marginTop="16dp"
android:layout_marginBottom="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@id/expandable_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/white"
android:textSize="16sp" />
<ImageButton
android:id="@id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|end"
android:background="@android:color/transparent"
android:padding="16dp"
android:src="@drawable/ic_keyboard_arrow_down_white_24dp"
android:tint="@color/white" />
</LinearLayout>
</com.ms.square.android.expandabletextview.ExpandableTextView>