【问题标题】:How to add an explanatory text before a list view in android?如何在android中的列表视图之前添加解释性文本?
【发布时间】:2013-04-18 16:05:52
【问题描述】:

我有一个列表视图,但在开始时我想放置一段文本,以帮助用户了解该列表的目的不是什么。之后我想显示列表并且我想是可滚动的。卷轴我知道怎么做,但文本部分没有。我尝试制作两种布局,一种用于文本,另一种用于列表,但我的 xml 立即变得充满错误。

这是我的xml

<?xml version="1.0" encoding="utf-8"?>


<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/legislatie1"
    android:orientation="vertical" >



    <ListView
        android:id="@+id/listView1"
        android:layout_width="wrap_content"
        android:layout_height="600dp"
        android:layout_alignParentRight="true"
        android:drawSelectorOnTop="true"
        android:textSize="10pt" >

    </ListView>

</RelativeLayout>

【问题讨论】:

  • 在列表视图上方放置一个文本视图。更新 textview 的文本

标签: android xml listview text


【解决方案1】:

如果您选择,您可以在 ListView 上方使用静态 TextView,但它不会随 ListView 一起滚动。另一种方法是向您的 ListView 添加一个 Header,它将随着列表滚动。 Header Tutorial

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-13
    • 1970-01-01
    相关资源
    最近更新 更多