我有一个linearlayout
,其中包含
textView
imageView
Horizontal recyclerview
TextView
Horizontal Recyclerview
Webview
如何在不将其放入scrollview
的情况下使其成为scrollable
发布于 2017-08-04 19:43:34
在不使用滚动视图的情况下使Linearlayout可滚动
如果你只在线性布局中使用列表视图,那么你不需要使用scrollview.Because listview is scrollable by default.But如果你还有其他组件,那么你可以在另一个scrollview.Make中分离这些组件,确保ScrollView只使用一个直接的子布局。下面是一个示例代码。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#ffffff">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:cacheColorHint="#00000000"/>
</LinearLayout>
发布于 2017-08-07 14:38:58
线性布局的设计并不是为了让其内容可滚动--只有通过将其嵌入到FrameLayout (或ScrollView,这是一个子类)中,您才能滚动/平移。为什么ScrollView不是一种选择?
顺便说一句,垂直滚动容器中的水平滚动容器不会提供良好的UI/UX,但还有其他方法可以实现你想要的效果。请告诉我们更多细节,我相信我们能帮到你
https://stackoverflow.com/questions/45320293
复制相似问题