Android Textview 文本在底部被截断

2024-01-29

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

显然我错过了一些明显的东西,但不知道是什么。[Issue] https://i.stack.imgur.com/GVWYH.png1 https://i.stack.imgur.com/GVWYH.png

这是代码:

<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那里有两个文本字段,所以看起来你完全可以接受第二个文本字段被切断。

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android Textview 文本在底部被截断 的相关文章

  • 如何制作一个向用户显示图像而不是文本的下拉列表?

    ObjectChoiceField 字段满足我的所有要求 但它并不漂亮 这就是我所拥有的 String pets Dog Cat Duck ObjectChoiceField dd new ObjectChoiceField My Pet
  • Spring Boot 1.4:Liquibase完成后的执行方法

    我有一个基于 Spring Boot 1 4 0 的项目 该项目使用 Liquibase liquibase 完成后是否可以执行方法 像 Bean 后处理器之类的东西 我想要做的是当应用程序在开发模式下启动时向我的数据库添加一些数据 在开发
  • 如果从超链接打开,应用程序将启动两次

    我正在开发一个应用程序 可以从多个地方启动 例如日历中的超链接 我在以下场景中面临问题 如果应用程序已启动并在后台运行 并且用户单击本机日历中的事件 超链接来启动应用程序 我的应用程序作为新实例启动两次 在正在运行的应用程序列表中 我可以看
  • 抽屉式导航不显示片段

    我创建了一个新的 Android Studio 项目 我的 MainActivity 是导航抽屉活动 所以 我无法显示碎片 我在互联网上和这里读过很多帖子 解释 我打开导航抽屉 选择菜单 播客 PodcastsFragment 应该显示 但
  • Windows:如何获取所有可见窗口的列表?

    无论如何都要使用相关技术重新标记 我不知道它们是什么 稍后我可能会提出更详细的问题 关于具体细节 但现在我正在尝试掌握 大局 我正在寻找一种方法来枚举 Windows 上的 真实可见窗口 我所说的 真正可见的窗口 就是指 用户所说的 窗口
  • 如何在调整大小时更改 JLabel 字体大小以填充 JPanel 可用空间?

    这里有一个类似的问题 如何更改 JLabel 的字体大小以获取最大大小 https stackoverflow com questions 2715118 how to change the size of the font of a jl
  • 调整 Java 类以提高 CPU 缓存友好性

    在设计java类时 对于实现CPU缓存友好性有哪些建议 到目前为止我学到的是应该尽可能多地使用 POD 即 int 而不是整数 这样 在分配包含对象时 数据将被连续分配 例如 class Local private int data0 pr
  • Android图层列表不显示比例可绘制项目?

    使用下面的图层列表 我的比例绘制从未显示 这是为什么 菜单 对话框 标题 xml
  • AWS Lambda 和 S3 - 上传的 pdf 文件为空/损坏

    我有一个 Spring 应用程序 在 AWS Lambda 上运行 它获取文件并将其上传到 AWS S3 Spring控制器发送一个MultipartFile到我的方法 使用 Amazon API Gateway 将其上传到 AWS S3
  • 如何在 JUnit 中缩短(或隐藏)包名称?

    我在 JUnit 中有很长的包名称 这使得很难看到正在运行哪些测试 不幸的是 使用 Eclipse 的 缩写包名称 不起作用 有没有办法隐藏或者最好缩短它们 None
  • Java编译错误:包不存在

    在我的工作区 wsPrivate 中 我有 3 个 gradle 项目 刽子手 像素视图 Reports PixelView 和 Reports 项目编译良好 然而 Hangman 使用这两个项目 并且有些在编译时找不到包 请参阅以下错误
  • 从 Java/Spring 检索 RabbitMQ 队列中未确认消息的数量

    有没有办法返回未确认的消息数 我正在使用此代码来获取队列中的消息数 DeclareOk declareOk amqpAdmin getRabbitTemplate execute new ChannelCallback
  • JPA中如何连接多个数据库?

    我有一个 Spring Boot 应用程序 当前使用 JPA 连接到单个数据库 application properties 文件中的连接详细信息 spring datasource url jdbc oracle thin localho
  • Android Studio:src/androidTest 和 src/main 文件夹之间的区别?

    我是 Android Studio 的新手 我的问题是 src androidTest 和 src main 文件夹有什么区别 我所有的课程应该放在哪里 Refer Android Studio 概述 http developer andr
  • 尝试在后台使用 AsyncTask 解析 JSON 时强制关闭

    我是 Android 开发新手 正在研究 json 数据 我设法让解析工作 我想显示一个 ProgressDialog 我读到我需要使用 AsyncTask 但由于某种原因 一旦我将相同的工作代码放入 doInBackground 中 即使
  • onActivityResult() 在 startActivityForResult() 之后未使用 Intent.ACTION_GET_CONTENT 调用

    我得到了我的主要Activity其中持有不同的Fragment的 一个片段使用户可以打开一个DialogFragment 该对话框打开声音文件列表 并且该对话框还包含一个 添加 按钮 用户应该能够从中添加自己的声音文件 为此 我想使用标准的
  • 异步方法的同步版本

    在 Java 中创建异步方法的同步版本的最佳方法是什么 假设您有一个包含这两种方法的类 asyncDoSomething Starts an asynchronous task onFinishDoSomething Called when
  • Android - onLoadFinished 未调用

    我遇到了装载机的问题 我有一个活动 它显示从本地数据库检索的记录列表 当活动启动时 记录会通过 LoaderManager initLoader 方法自动加载 还可以通过 ActionBarSherlock 中的刷新按钮手动刷新列表 但是
  • 如何在运行时检查授予权限?

    In Android M 预览版 用户可以选择特定的应用程序并检索特定的权限 所以我问如何在运行时检查授予权限 您可以使用以下复制的代码https android googlesource com platform frameworks b
  • 在 Android 上提取/修改视频帧

    我有一个视频文件 我想获取视频的每一帧并对帧进行一些修改 例如在其中绘制另一个位图 放置一些文本等 Android 中是否有任何 API 框架可用于从视频中获取帧 我在 iOS 中使用他们的 AVFramework 做了类似的事情 如果可以

随机推荐