Reputation: 240
I am using this library to achieve expandable cards and it works fine except for two major concerns viz:
It requires the min api level to be 21 and previously my min api level was 16. Will this work well on lower devices. There's an option to override this in the library's manifest file but I don't think it's a good idea.
I have layout like below which contains another layout with a textview but the text is not showing fully, only the first line is visible. Here's the layout:
<com.alespero.expandablecardview.ExpandableCardView
android:id="@+id/focusCardLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/metaCard"
android:layout_marginBottom="10dp"
app:expandOnClick="true"
app:inner_view="@layout/session_inner_card_focus_pts_layout"
app:title="Focus Points" />
and the inner_view
layout:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/focusPointsTV"
android:layout_margin="5dp"
android:layout_marginBottom="10dp"
android:text="You cannot win matches without scoring points so it's important your players can shoot accurately."
android:textSize="18sp"
android:padding="10dp">
</TextView>
Is this a fault in my layout or the library. I have set input_type to short/long message, still no effect.
Is there other means of expanding-collapsing
cardviews android? Thanks.
Upvotes: 1
Views: 623
Reputation: 3711
I tried your code, and I think your issue come from the library.
I know a lib that resolve your issue as well, that is this library
<!-- sample xml -->
<com.ms.square.android.expandabletextview.ExpandableTextView
xmlns:android="http://schemas.android.com/apk/res/android"
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:textColor="#666666" />
<ImageButton
android:id="@id/expand_collapse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:layout_gravity="right|bottom"
android:background="@android:color/transparent"/>
</com.ms.square.android.expandabletextview.ExpandableTextView>
It's work for me and I hope it will help you too.
Upvotes: 1