Android:NestedScrollView中的FrameLayout全屏显示
我正在实现可折叠工具栏。我的布局就像Android:NestedScrollView中的FrameLayout全屏显示,android,material-design,Android,Material Design,我正在实现可折叠工具栏。我的布局就像 <CoordinatorLayout> <AppBarLayout> <CollapsingToolbarLayout> <ImageView/> <Toolbar/> </CollapsingToolbarLayout> </AppBarLayout> <and
<CoordinatorLayout>
<AppBarLayout>
<CollapsingToolbarLayout>
<ImageView/>
<Toolbar/>
</CollapsingToolbarLayout>
</AppBarLayout>
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:background="@android:color/white">
<FrameLayout
android:id="@+id/container_body"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>
</CoordinatorLayout>
试试这个代码
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:background="@android:color/white">
<RelativeLayout
android:id="@+id/relative_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<FrameLayout
android:id="@+id/container_body"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
然后指定FrameLayout的大小FrameLayout将其子项放置在按照层次堆叠的层中。要执行您想要执行的操作,您应该在位于framelayout内的LinearLayout内膨胀片段。尝试不工作。同样的问题当你说它需要全屏时,这是否意味着你看不到里面有工具栏和Imageview的AppBar?你能把完整的xml代码放在这里吗?什么是
layout\u height
属性profile\u detail\u include\u layout's
parent?你想在你的碎片里填充什么?它能定高吗?
<android.support.v4.widget.NestedScrollView
android:id="@+id/scroll"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:background="@android:color/white">
<RelativeLayout
android:id="@+id/relative_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<FrameLayout
android:id="@+id/container_body"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>