ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

java – Android Textview文本在底部被截断

2019-07-16 07:26:45  阅读:438  来源: 互联网

标签:java android textview android-textview


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

很明显我错过了一些明显的东西,但不知道是什么.
[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”.

另外,删除min_height属性. Yout在那里有两个文本区域,所以看起来你完全可以完成第二次切断.

要告诉你的目标很难,但看看是否有帮助.

标签:java,android,textview,android-textview
来源: https://codeday.me/bug/20190716/1475925.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有