Контент TextView обрезается внизу - PullRequest
1 голос
/ 18 мая 2019

в моем приложении TextView, указанный как R.id.text3, обрезает его содержимое, иногда показывается половина строки. Кроме того, многоточие тоже не работает. Из макета, вы видите, что я должен добавить, чтобы текст выделял отрезанную линию и (в лучшем случае) занимал многоточие тоже в конце?

Если вам может понадобиться мой код CursorAdapter, пожалуйста, не стесняйтесь спрашивать его! Я, кстати, также определяю отступ для "linearLayout", чтобы соответствовать панели навигации.

This is how it looks.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:airbnb="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?android:attr/windowBackground"
android:foreground="?android:attr/selectableItemBackground"
android:id="@+id/baseRelativeLayout"
android:focusable="true"
android:clickable="true"
android:orientation="vertical">

<LinearLayout
    android:layout_width="match_parent"
    android:orientation="vertical"
    android:id="@+id/linearLayout"
    android:layout_height="match_parent">

    <RelativeLayout
        android:id="@+id/relative_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:focusable="false"
        android:clickable="false"
        android:layout_marginTop="5dp"
        android:minHeight="80dp">

        <ImageView
            android:id="@+id/main_icon"
            android:layout_width="@dimen/entry_img_size"
            android:layout_height="@dimen/entry_img_size"
            android:layout_centerVertical="true"
            app:shapeAppearance="@style/ShapeAppearance.Daily.MediumComponent"
            android:layout_marginLeft="16dp"
            android:clickable="true"
            android:scaleType="centerCrop"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_centerVertical="true"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="15dp"
            android:layout_marginTop="10dp"
            android:id="@+id/titleLinearLayout"
            android:layout_toRightOf="@+id/main_icon"
            android:orientation="vertical">

            <TextView
                android:id="@android:id/text1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:drawablePadding="3dp"
                android:ellipsize="end"
                android:gravity="top"
                android:maxLines="3"
                android:textSize="28sp"
                android:textColor="?attr/contentColor"
                android:clickable="true"
                android:textStyle="bold"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textIsSelectable="false"/>

            <TextView
                android:id="@android:id/text2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:alpha="0.7"
                android:textColor="?attr/contentColor"
                android:drawablePadding="3dp"
                android:singleLine="true"
                android:clickable="true"
                android:textAppearance="?android:attr/textAppearanceSmall"
                android:textIsSelectable="false"/>

        </LinearLayout>

        <com.airbnb.lottie.LottieAnimationView
            android:id="@+id/favorite_icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:paddingTop="10dp"
            airbnb:lottie_fileName="star.json"
            airbnb:lottie_scale="0.3"
            airbnb:lottie_autoPlay="false"
            airbnb:lottie_loop="false"
            android:layout_alignParentEnd="true" />

    </RelativeLayout>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/imageView"
        android:visibility="gone"
        android:clickable="true"
        android:layout_gravity="center_horizontal"
        android:scaleType="fitStart"
        android:adjustViewBounds="true"
        android:layout_marginBottom="5dp"
        android:maxHeight="500dp"
        android:layout_marginTop="5dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:focusable="true" />

    <TextView
        android:id="@+id/text3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="1dp"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:ellipsize="end"
        android:textColor="?attr/contentColor"
        android:textSize="18sp"
        android:focusable="false"
        android:clickable="false"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textIsSelectable="false"/>


</LinearLayout>

Ответы [ 2 ]

1 голос
/ 18 мая 2019

Вы должны поместить свой LinearLayout (linearLayout) в ScrollView

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
         android:layout_width="match_parent"
         android:orientation="vertical"
         android:id="@+id/linearLayout"
         android:layout_height="match_parent">

              <....
              ....>

    </LinearLayout>

</ScrollView>
0 голосов
/ 18 мая 2019

для размера эллипса, попробуйте добавить android: maxlines. я думаю, что для линии разреза вы должны использовать прокрутку.

...