如何在android中以编程方式添加水平和垂直scollview

如何在android中以编程方式添加水平和垂直scollview,android,scrollview,Android,Scrollview,我想在android中动态添加这种类型的水平和垂直滚动视图。但我没有添加标题。如果有人知道如何在水平视图的每个顶部添加标题。这里第一个是不同的,其他的是相同的 我认为您应该首先使用列表视图,然后使用水平滚动视图在其中添加项目。使用任何适配器设置列表视图中的项目。通过这种方式,您可以垂直滚动(ListView),也可以水平滚动 参考: 试试这个: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"

我想在android中动态添加这种类型的水平和垂直滚动视图。但我没有添加标题。如果有人知道如何在水平视图的每个顶部添加标题。这里第一个是不同的,其他的是相同的


我认为您应该首先使用
列表视图
,然后使用
水平滚动视图
在其中添加项目。使用任何适配器设置
列表视图
中的项目。通过这种方式,您可以垂直滚动(
ListView
),也可以水平滚动

参考:

试试这个:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:scrollbars="vertical">

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="320px" android:layout_height="fill_parent">

    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/linlay" android:layout_width="320px"
        android:layout_height="fill_parent" android:stretchColumns="1"
        android:background="#000000"/>

</HorizontalScrollView>