Android 坐标布局中的嵌套滚动视图未显示过滚动
我有Android 坐标布局中的嵌套滚动视图未显示过滚动,android,android-coordinatorlayout,nestedscrollview,overscroll,Android,Android Coordinatorlayout,Nestedscrollview,Overscroll,我有嵌套的ScrollView和一些文本,因为它们在 CoordinatorLayout,当我将其滚动到NestedScrollView的末尾时,不会显示overscroll效果,我猜当我到达末尾并尝试滚动更多时,我不会滚动NestedScrollView,而是滚动CoordinatorLayout <android.support.design.widget.CoordinatorLayout android:id="@+id/activity_news_main_content
嵌套的ScrollView
和一些文本,因为它们在
CoordinatorLayout
,当我将其滚动到NestedScrollView
的末尾时,不会显示overscroll效果,我猜当我到达末尾并尝试滚动更多时,我不会滚动NestedScrollView,而是滚动CoordinatorLayout
<android.support.design.widget.CoordinatorLayout
android:id="@+id/activity_news_main_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="@+id/activity_news_appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/activity_news_background_height"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/activity_news_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:background="@color/activity_news_collapsing_toolbar_background_color"
app:contentScrim="@color/colorPrimary"
app:expandedTitleMarginBottom="@dimen/activity_news_title_margin_bottom"
app:expandedTitleMarginStart="@dimen/activity_news_title_margin_start"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/activity_news_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
app:layout_scrollFlags="scroll|exitUntilCollapsed"/>
<View
android:layout_width="match_parent"
android:layout_height="@dimen/activity_news_view_height"
android:layout_gravity="bottom"
android:background="@color/activity_news_collapsing_toolbar_background_color"/>
<include
android:id="@+id/app_bar"
layout="@layout/news_app_bar"/>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/activity_news_padding">
<TextView
android:id="@+id/activity_news_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_news_subtitle_bottom_padding"/>
<TextView
android:id="@+id/activity_news_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
那设计是错误的
请参见:
<include
android:id="@+id/app_bar"
layout="@layout/news_app_bar"/>
并阅读以下内容:
折叠工具栏布局
是实现
正在折叠应用程序栏
NestedScrollView中的LinearLayout应该将高度设置为“wrap_content”,但仍然不起作用……事实上,一次快速的谷歌搜索给了我一份针对这个问题的错误报告。如果向上或向下抛,有时可能会看到滚动效果。你可以检查这里的报告工具栏必须在折叠工具栏布局中,这样当我向上滚动时它会折叠,我尝试了这种方式仍然没有效果。你可以把它放在<代码>折叠工具栏中,这取决于你。它正在使用这种设计。让我知道那是什么布局,或者使用这个基础继续!
<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/activity_news_main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<!--Here is the contents-->
<!--<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/activity_news_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/activity_news_description"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>-->
</android.support.v4.widget.NestedScrollView>
<android.support.design.widget.AppBarLayout
android:id="@+id/activity_news_appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbarmain"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/activity_news_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
app:contentScrim="@color/colorPrimary"
app:layout_collapseMode="pin"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:id="@+id/activity_news_image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"
app:layout_scrollFlags="scroll|exitUntilCollapsed" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
</android.support.design.widget.CoordinatorLayout>