gpt4 book ai didi

android - 如何在不使用 Scrollview 的情况下使 LinearLayout 可滚动

转载 作者:太空宇宙 更新时间:2023-11-03 12:23:35 25 4
gpt4 key购买 nike

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/bag"
android:layout_height="fill_parent" android:layout_width="fill_parent"
android:orientation="vertical" >

<RelativeLayout
android:id="@+id/relativeLayout2"
style="@style/relbag"
android:layout_width="fill_parent"
android:layout_height="wrap_content">

<TextView style="@style/CodeFont"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="18dp"
android:textSize="15dp"
android:text="General Preference"
android:id="@+id/genpref">
</TextView>


<ListView
android:id="@+id/settingsListView1"
style="@style/listbag"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"

android:background="@drawable/radius"
android:listSelector="@drawable/list_selector"
android:paddingTop="8dip"
android:paddingBottom="8dip"
android:scrollbars="none"
android:layout_below="@id/genpref"/>

<TextView style="@style/CodeFont"
android:id="@+id/notpref"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:textSize="15dp"
android:text="Notification Preference"
android:layout_below="@id/settingsListView1">
</TextView>


<ListView style="@style/listbag" android:id="@+id/settingsListView2" android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="15dip" android:layout_marginRight="15dip"
android:layout_marginBottom="15dip"
android:background="@drawable/radius"
android:paddingLeft="5dip" android:paddingRight="5dip"
android:paddingTop="15dip" android:paddingBottom="15dip"
android:listSelector="@drawable/list_selector"
android:layout_below="@id/notpref"
android:scrollbars="none"
/>
</RelativeLayout>
</LinearLayout>

enter image description here

在我的应用程序中,我想在 linearlayout 中创建两个 ListView ,并使 linearlayout 可滚动而不使用 ScrollView。据我所知,scrollview 在使用 listview 时存在问题。这张图片不是我想要的,但让我们假装在 ListView 下方有另一个 ListView 。所以我想显示 ListView 的所有可用项目(在我的应用程序 2 ListView 的项目中)并使 LinearLayout 可滚动。 ScrollView 运行不正常,因为它必须只有一个直接子级。我找不到解决方案。所以请帮我解决,谢谢

最佳答案

我认为将多个列表放在一个屏幕中不是一个好主意,因为触摸会变得很奇怪并且使用屏幕会变得复杂。您应该考虑其他方法将多个列表一起显示在一个屏幕中。您可以水平排列多个在单个屏幕中列出。Romain Guy(Google 开发人员)也在以下链接中接受了这一事实....

http://groups.google.com/group/android-developers/browse_thread/thread/77acd4e54120b777

我希望这个答案能帮助你解决你的问题。

关于android - 如何在不使用 Scrollview 的情况下使 LinearLayout 可滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8306679/

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