Java 滚动时如何在工具栏下方固定linearlayout
我想实现如下图所示的效果Java 滚动时如何在工具栏下方固定linearlayout,java,android,Java,Android,我想实现如下图所示的效果 我想在工具栏下粘贴一个linearlayout,并使其在滚动过程中的给定时刻出现您可以尝试此布局 原始布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"
我想在工具栏下粘贴一个linearlayout,并使其在滚动过程中的给定时刻出现您可以尝试此布局 原始布局
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/toolbar_layout"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
.
.
</LinearLayout>
</ScrollView>
<LinearLayout>
.
.
您可以使用折叠工具栏或根据需要进行自定义
请参阅下面的链接
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<!-- YOUR ITEMS BETWEEN TABBAR AND APPBAR-->
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<LinearLayout
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- YOUR CUSTOM TABBAR-->
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- YOU MAIN CONTENT-->
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
谢谢你,但是我想在ScLoVIEW中在滚动视图的顶部放置一个布局(线性布局或RealValayOutton或按钮),但是我想在滚动时在滚动视图的顶部放置一个布局(线性布局或RealValayOutton或按钮)。