Android Textview 文本在底部被切断 [英] Android Textview text cut off at bottom

查看:34
本文介绍了Android Textview 文本在底部被切断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有 2 个文本视图,一个在另一个之上,但是当填充第二个文本视图时,剪切在底部被切断.标题为 header_subtitle 的文本视图存在问题

So I have 2 textviews, one above the other, but when the second text view is populated the cut is cut off at the bottom. The textview, titled header_subtitle has the issue in question

显然我遗漏了一些明显的东西,但不知道是什么.[问题]1

Clearly Im missing something obvious, but dont know what. [Issue]1

代码如下:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <include
        layout="@layout/search_bar_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:visibility="gone" />

    <RelativeLayout
        android:id="@+id/container_results"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:animateLayoutChanges="true"
        android:visibility="gone">

        <LinearLayout
            android:id="@+id/container_header"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:minHeight="@dimen/product_results_header_height"
            android:orientation="vertical"
            android:padding="?marginNormal">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center_vertical"
                android:orientation="horizontal">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:orientation="vertical" >

                    <FeatureTextView
                        android:id="@+id/header_title"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ellipsize="end"
                        android:maxLines="2"
                        android:textAppearance="?taTitleXL" />

                    <FeatureTextView
                        android:id="@+id/header_subtitle"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:ellipsize="end"
                        android:maxLines="1"
                        android:layout_gravity="fill"
                        android:textAppearance="?taTitleXL"
                        android:padding="1sp"
                        android:visibility="gone"/>

                </LinearLayout>

                <Spinner
                    android:id="@+id/sort_spinner"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="?marginNormal" />

                <FeatureButton
                    android:id="@+id/refine_btn"
                    style="?buttonTertiary"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="?marginNormal"
                    android:text="@string/product_results_refine" />
            </LinearLayout>

            <SimpleFlowLayout
                android:id="@+id/category_links"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="?marginSmall"
                android:horizontalSpacing="?marginTiny"
                android:maxLines="2" />
        </LinearLayout>

        <include
            android:id="@+id/divider_horizontal"
            layout="@layout/divider_horizontal"
            android:layout_width="match_parent"
            android:layout_height="@dimen/divider_size"
            android:layout_below="@+id/container_header" />

        <FeatureTextView
            android:id="@+id/browse_no_results"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/divider_horizontal"
            android:layout_margin="?marginNormal"
            android:text="@string/product_results_no_results"
            android:textAppearance="?taTitleM"
            android:visibility="gone" />

        <GridView
            android:id="@+id/product_grid"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/divider_horizontal"
            android:numColumns="@integer/product_grid_cols"
            android:overScrollMode="@null"
            android:stretchMode="columnWidth" />

        <include
            android:id="@+id/progress_footer"
            layout="@layout/loading"
            android:layout_width="@dimen/progress_view_height"
            android:layout_height="@dimen/progress_view_height"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"/>

        <NoFilteredResultsView
            android:id="@+id/noFilteredResults"
            android:layout_below="@id/divider_horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:visibility="gone" />

        <include
            android:id="@+id/coach_mark"
            layout="@layout/view_coach_mark"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_marginEnd="@dimen/coach_mark_margin_end"
            android:layout_marginTop="@dimen/coach_mark_margin_top" />
    </RelativeLayout>

</FrameLayout>

推荐答案

您的一个 LinearLayouts 的高度设置为 fill_parent.将其更改为 wrap_content.

One of your LinearLayouts has height set to fill_parent. change it to wrap_content.

另外,删除 min_height 属性.Yout 在那里有两个文本字段,所以看起来你对第二个被切断完全没问题.

Also, remove the min_height attribute. Yout have two text fields in there, so it looks like you're totally OK with the second getting cut off.

很难说你要做什么,但看看这是否有帮助.

It's kind of hard to tell what you're going for, but see if that helps.

这篇关于Android Textview 文本在底部被切断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆