gpt4 book ai didi

java - 带有 ScrollView 的列表

转载 作者:行者123 更新时间:2023-12-01 15:05:15 24 4
gpt4 key购买 nike

添加滚动条后,我有一个带有 scrollview 的列表,我尝试更改高度 ScrollView ,因此列表位于布局的中心,高度更大,但它不起作用。

最佳答案

ListView 是可滚动的。您不能将 ListView 放入 ScrollView 内部。

尝试这个代码示例

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_all_1" >

<LinearLayout
android:id="@+id/bottom_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:orientation="vertical" >
</LinearLayout>

<include
android:id="@+id/top_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="40dp"
android:layout_marginTop="91dp"
layout="@layout/layout_header" />

<include
android:id="@+id/footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/bottom_menu"
android:layout_alignParentLeft="true"
android:layout_marginBottom="40dp"
layout="@layout/layout_footer" />

<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_above="@+id/footer"
android:layout_below="@+id/top_header"
android:layout_centerHorizontal="true" >
</ListView>

</RelativeLayout>

关于java - 带有 ScrollView 的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13048873/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com