代码之家  ›  专栏  ›  技术社区  ›  Andromeda

可扩展卡片视图文本不完全可见

  •  1
  • Andromeda  · 技术社区  · 6 年前

    我在用 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>
    

    这是我的布局还是图书馆的问题。我已将输入类型设置为短/长消息,但仍然没有效果。 还有别的办法吗 expanding-collapsing CardViews安卓?谢谢。

    1 回复  |  直到 6 年前
        1
  •  1
  •   GianhTran    6 年前

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

    我知道一个lib也能解决你的问题,那就是 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>
    

    这是我的工作,我希望它也能帮助你。