ExpandableListView问题

发布于 2025-01-07 07:12:18 字数 697 浏览 2 评论 0原文

我正在尝试创建一个可扩展列表,在其中可以使 group_row 的高度更小,以使用更少的屏幕空间。当我更改 LinearLayout 的布局高度时,它会将高度更改为我想要的高度,但每个 TextView 的所有标签都不会显示;他们消失了。然而,当它是wrap_content时,文本就会出现。有什么想法如何解决吗?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="35dp">

<TextView android:id="@+id/childname
        android:paddingLeft="0dp"
        android:textSize="16dp"
        android:textStyle="italic"
        android:layout_width="150dp"
        android:layout_height="wrap_content">
    </TextView>

</LinearLayout>

I'm trying to create an expandable list where I can make the height of the group_row smaller, to use less screen space. When I change the layout_height of the LinearLayout, it changes the height to what I want it, but all of the labels of each TextView aren't displayed; they disappear. However, when it is wrap_content, the text appears. Any ideas how to fix?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="35dp">

<TextView android:id="@+id/childname
        android:paddingLeft="0dp"
        android:textSize="16dp"
        android:textStyle="italic"
        android:layout_width="150dp"
        android:layout_height="wrap_content">
    </TextView>

</LinearLayout>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁人与我共长歌 2025-01-14 07:12:18

Textview id 应该是 android:id="@+id/childname"

Textview id should be android:id="@+id/childname"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文