我有以下布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/treasure_background"
android:fitsSystemWindows="false">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
app:layout_behavior="trasurhunt.nicbit.com.traserhunt.schedule.FlingBehavior">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
android:elevation="0dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="66.5dp"
android:orientation="vertical"
android:paddingBottom="15dp"
android:background="@color/treasure_background"
app:layout_collapseMode="parallax">
<LinearLayout
android:id="@+id/infoRL"
android:orientation="vertical"
app:layout_collapseMode="parallax"
android:layout_width="match_parent"
android:paddingBottom="20dp"
android:layout_height="wrap_content"
android:background="@color/treasure_yellow">
<com.joooonho.SelectableRoundedImageView
android:id="@+id/hostImage"
android:layout_width="62dp"
android:layout_gravity="center_horizontal"
android:layout_height="62dp"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
app:sriv_left_bottom_corner_radius="0dp"
app:sriv_oval="true"
app:sriv_right_bottom_corner_radius="0dp"
android:src="@drawable/default_image"/>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="@+id/hostName"
android:layout_gravity="center_horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/hostImage"
android:layout_centerHorizontal="true"
android:layout_marginTop="4dp"
android:text="Speaker Name"
android:textColor="@color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="@+id/scheduleTitle"
android:layout_gravity="center_horizontal"
android:textAlignment="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/hostName"
android:layout_centerHorizontal="true"
android:layout_marginTop="29dp"
android:text="Schedule Title"
android:textColor="@color/treasure_black"
android:textSize="21sp" />
<RelativeLayout
android:id="@+id/locationRL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/scheduleTitle"
android:layout_gravity="center"
android:layout_marginTop="20.5dp"
>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="@+id/locationLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/location"
android:textColor="@color/treasure_black"
android:textSize="14sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="@+id/eventHallName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/locationLabel"
android:layout_toEndOf="@+id/locationLabel"
android:text=" Hall Of Event"
android:textColor="@color/treasure_black"
android:textSize="14sp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/timeRL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/locationRL"
android:layout_gravity="center"
android:layout_marginTop="4dp"
>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/timeLabel"
android:textColor="@color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="@+id/startTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/time"
android:layout_toEndOf="@+id/time"
android:text="05:30 AM"
android:textColor="@color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="@+id/toDash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/startTime"
android:layout_toEndOf="@+id/startTime"
android:text=" - "
android:textColor="@color/treasure_black"
android:textSize="15sp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="@+id/endTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/toDash"
android:layout_toEndOf="@+id/toDash"
android:text="05:30 AM"
android:textColor="@color/treasure_black"
android:textSize="15sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="trasurhunt.nicbit.com.traserhunt.schedule.FixedScrollingViewBehavior"
android:background="@color/treasure_background"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="70dp"
android:background="@color/treasure_background"
android:orientation="vertical"
android:paddingLeft="19.5dp">
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="@+id/synopsisLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/synopsis"
android:textColor="@color/treasure_cyan"
android:textSize="21sp"
android:layout_marginTop="31dp"
android:layout_marginBottom="14dp" />
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="@+id/synopsis"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="15dp"
android:text="@string/loremIpsumPara"
android:textColor="@color/treasure_white"
android:layout_marginRight="15dp"
/>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextViewBold
android:id="@+id/aboutSpeakerLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/aboutSpeakerLabel"
android:textColor="@color/treasure_cyan"
android:textSize="21sp"
android:layout_marginTop="36.5dp"
android:layout_marginBottom="14dp"
/>
<trasurhunt.nicbit.com.traserhunt.utility.CentuaryGothicTextView
android:id="@+id/aboutSpeaker"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="15dp"
android:text="@string/loremIpsumPara"
android:textColor="@color/treasure_white"
/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<include
layout="@layout/custom_toolbar" />
<Button
android:id="@+id/checkInButton"
android:text="@string/checkInString"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="false"
android:layout_gravity="bottom"
android:layout_centerHorizontal="true"
style="@style/Widget.AppCompat.Button.Colored"
android:backgroundTint="@color/treasure_yellow"
android:background="#e2fb02"
android:textColor="@color/treasure_dark_gray"
android:textSize="22sp"
android:paddingTop="4dp"
android:paddingBottom="4dp" />
</android.support.design.widget.CoordinatorLayout>
当我尝试向上滚动时,它无法正常工作并且滞后并卡住,而滚动下载似乎很好。我无法弄清楚为什么。 我经常搜索并做了很多改动,但仍然无法正常工作。
这是我的活动的样子
答案 0 :(得分:0)
检查它是否适合你
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="end">
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/app_bar_height"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/backgrnd"
android:contentDescription=""
android:fitsSystemWindows="true"
android:scaleType="fitXY"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a3441f77"
android:fitsSystemWindows="true"
android:scaleType="fitXY"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<LinearLayout
android:id="@+id/listarrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="true"
android:orientation="horizontal"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="UseCompoundDrawables,UselessParent">
<TextView
android:id="@+id/coachingname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:text="Kota"
android:textSize="20sp"
android:textStyle="bold"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="HardcodedText,RtlHardcoded" />
<ImageView
android:id="@+id/imageList"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:src="@drawable/arrow"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription,RtlHardcoded" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
app:popupTheme="@style/AppTheme.PopupOverlay"></android.support.v7.widget.Toolbar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="UselessParent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|left"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="10dp"
android:text="Housing.com"
android:textColor="#ffffff"
android:textStyle="bold"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="HardcodedText,RtlHardcoded,RtlSymmetry" />
<ImageView
android:id="@+id/drowerimage"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center|end"
android:layout_weight=".25"
android:clickable="true"
android:src="@drawable/user"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.75"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/collapsing_logo"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
app:layout_collapseMode="pin">
<LinearLayout
android:id="@+id/search1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginBottom="4dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:background="@drawable/search_shape"
android:orientation="horizontal"
app:layout_collapseMode="pin"
tools:ignore="UselessParent">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center_vertical"
android:layout_margin="10dp"
android:src="@drawable/ic_action_search" />
<android.support.v7.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Search"
android:textColor="#FF8C8C8C"
android:textSize="17sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</FrameLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<ViewStub
android:id="@+id/layout_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.75"
android:inflatedId="@+id/message_layout" />
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_home"
app:menu="@menu/activity_home_drawer" />
</android.support.v4.widget.DrawerLayout>
我在 NestedScrollView 中使用 ViewStub ,因此您可以在Viewstub中充气您的概要部分