繁体   English   中英

如何通过横向滚动检查卡内的TextView扩展recyclerView中的cardView尺寸?

[英]How to check the TextView inside card extends the cardView size in recyclerView with Horizontal scrolling?

我在我的应用我曾经Cardview显示利用TextView的每个页面的上下文创建一个读者。 每个cardView只有一个Textview

在这里,我使用的水平滚动的CardView高度为“ wrap_content”

问题

因此,现在的问题是每个页面中的页面内容都是动态的。 当我显示TextView内容时-当内容太大时,底部的某些行会被截断,如下面的图片所示-

在此处输入图片说明

我想在下一张卡片中显示,其中没有线会像下面这样被截断-

在此处输入图片说明

这是每个布局项下面给出的代码-

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="5dp"
    >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        >

            <android.support.v7.widget.CardView
                xmlns:card_view="http://schemas.android.com/apk/res-auto"
                android:id="@+id/card_view_left"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                card_view:cardCornerRadius="5dp"
                card_view:contentPadding="10dp"
                card_view:cardBackgroundColor="@color/colorTransparent"
                card_view:cardElevation="4dp"
                card_view:cardMaxElevation="5dp"
                android:layout_marginBottom="12dp"
                android:layout_marginRight="10dp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="-7dp"
                >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"

                    android:orientation="vertical"
                    >

                <TextView
                    android:id="@+id/tvPageNo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"

                    android:layout_gravity="right"
                    android:text=""
                    android:layout_marginRight="20dp"
                    android:visibility="gone"

                    />

                <com.actinarium.aligned.TextView
                    android:layout_marginStart="10dp"
                    android:layout_marginEnd="10dp"
                    android:id="@+id/tv_content"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"

                    android:textAppearance="@style/TextAppearance.AppCompat.Body1"
                    android:textSize="14sp"

                    app:leading="16sp"
                    app:firstLineLeading="24sp"

                    android:layout_marginBottom="10dp"

                    />


                </LinearLayout>


            </android.support.v7.widget.CardView>

        <View
            android:id="@+id/viewPageUnderLine"
            android:layout_width="fill_parent"
            android:layout_height="2dp"
            android:background="#c0c0c0"

            android:layout_marginTop="10dp"
            android:layout_marginLeft="50dp"
            android:layout_marginRight="50dp"
            android:visibility="gone"
            />

    </LinearLayout>


    <com.wang.avi.AVLoadingIndicatorView
        android:id="@+id/loading_indicator"
        android:layout_centerInParent="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:indicatorName="LineScaleIndicator"
        app:indicatorColor="@color/colorOrange"

        />

</RelativeLayout>

最好的方法是设置android:maxLines =“ 10”和android:minLines =“ 10”。 然后,父卡片视图的高度应与文本视图匹配。 如果任何文本都将被截断,则将截断的文本放入下一个遵循上述规则的卡片视图中。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM