GridLayout 中 TextView 的动态高度 [英] Dynamic height of TextView within a GridLayout

查看:20
本文介绍了GridLayout 中 TextView 的动态高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用具有库兼容性的 GridLayout 时遇到问题(没有尝试过).我正在使用 app:layout_gravity="fill_horizo​​ntal" 而不是 android:layout_gravity="fill_horizo​​ntal"TextView 内的所有内容均未显示.为了显示所有内容,我必须设置 TextView 标题"的高度,但我想要一个动态高度,而不是设定高度.

I have a problem using GridLayout using library compatibility (not tried without). I am using app:layout_gravity="fill_horizontal" instead of android:layout_gravity="fill_horizontal" but all the content inside the TextView is not displayed. In order to display everything, I have to set the height of the TextView "Title" but I want a dynamic height, not a set height.

有什么想法吗?

推荐答案

你必须为 TextView 设置 layout_width="0dp"layout_gravity="fill_horizo​​ntal".

You have to set layout_width="0dp" and layout_gravity="fill_horizontal" for the TextView.

<TextView
    android:layout_width="0dp"
    android:layout_gravity="fill_horizontal" />

请在此处查看完整示例:https://groups.google.com/d/msg/android-developers/OmH3VBwesOQ/ZOGR0SGvC3cJ 或此处:http://daniel-codes.blogspot.com/2012/01/gridlayout-view-clipping-issues.html

Please, see full example here: https://groups.google.com/d/msg/android-developers/OmH3VBwesOQ/ZOGR0SGvC3cJ or here: http://daniel-codes.blogspot.com/2012/01/gridlayout-view-clipping-issues.html

这篇关于GridLayout 中 TextView 的动态高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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