如何在Android中设计复杂的用户界面
如何在RecyclerView上有ViewPager,或者在ScrollView中有多个RecyclerViews?我设计了以下布局,但滚动时出现一些问题。 什么问题,我该如何解决?如何在Android中设计复杂的用户界面
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#dcdcdc"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".ActivityMain"
tools:showIn="@layout/app_bar_main">
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="200dip"
/>
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</ScrollView>
我试图compile 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
与
<com.bartoszlipinski.recyclerviewheader2.RecyclerViewHeader
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top">
1-首先它支持11 SDK或更大,
2-其次ViewPager
在头RecyclerView
不会工作。 和我试过RecyclerView
layout_width="wrap_content"
但它只是在sdk21中支持。
我该如何解决RecyclerView的滚动问题?
尝试丢失顶部的ScrollView并使用ListView代替RecyclerView。
ScrollView在这里是不必要的,你需要使用ViewPager来处理RecyclerView,因为它消耗所有的触摸事件。如果你能用ListView逃脱,那会更简单。
谢谢,listview和RecyclerView之间没有什么不同,为什么我应该使用listView? 。和scrollview我想滚动viewPager和逐步隐藏它 – HPbyP
因为与ListView你不会有一个ViewPager的问题。我不知道你的意思是通过逐渐滚动和隐藏它,但是如果它像一个按下按钮时滑出的动画,那么你使用的是调整大小的动画,而不是ScrollView。 – vladimir123
你可以把你的视图寻呼机应用程序栏在collapssing工具栏布局,这将是好的
任何帮助将不胜感激。 – HPbyP