ExpandableCardView 文本不完全可见

ExpandableCardView Text Not Fully Visible

我正在使用 this library 来实现可扩展卡,它工作正常,除了两个主要问题,即:

  1. 它要求最低 api 等级为 21,之前我的最低 api 等级为 16。这在低端设备上是否有效?在库的清单文件中有一个选项可以覆盖它,但我认为这不是一个好主意。

  2. 我的布局如下所示,其中包含另一个带有文本视图的布局,但文本没有完全显示,只有第一行可见。这是布局:

         <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" />
    

inner_view 布局:

<?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>

这是我的布局错误还是库错误。我已将input_type 设置为short/long 消息,仍然没有效果。 expanding-collapsing cardviews android 还有其他方法吗?谢谢。

我试过你的代码,我认为你的问题来自图书馆。

我知道一个库也可以解决您的问题,那就是 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>

对我有用,希望对你也有帮助。