在android中,如何将视图元素粘贴在折叠工具栏布局工具栏下方?
正在尝试构建一个Android应用程序,其中包含一个折叠工具栏布局和一个始终位于工具栏底部正下方的视图元素 我想我只是在整个appbarlayout中搞乱了我的组织,但我似乎无法确定正确的顺序 任何帮助都会很好! 谢谢- 这是我的活动xml在android中,如何将视图元素粘贴在折叠工具栏布局工具栏下方?,android,toolbar,android-collapsingtoolbarlayout,Android,Toolbar,Android Collapsingtoolbarlayout,正在尝试构建一个Android应用程序,其中包含一个折叠工具栏布局和一个始终位于工具栏底部正下方的视图元素 我想我只是在整个appbarlayout中搞乱了我的组织,但我似乎无法确定正确的顺序 任何帮助都会很好! 谢谢- 这是我的活动xml <android.support.design.widget.AppBarLayout android:id="@+id/app_bar" android:layout_width="match_parent"
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="244dp"
android:fitsSystemWindows="true"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbarLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:collapsedTitleTextAppearance="@style/CollapsedTheme"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleGravity="center|bottom"
app:expandedTitleMarginBottom="20dp"
app:expandedTitleMarginEnd="20dp"
app:expandedTitleMarginStart="20dp"
app:expandedTitleTextAppearance="@style/ExpandedTheme"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:theme="@style/ToolbarColoredBackArrow">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="vertical">
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_product" />
我想补充一下
<RelativeLayout
android:layout_below="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@color/blue"/>
使其始终位于工具栏下方,但当折叠工具栏布局滚动到屏幕顶部时,它会一直粘在它下面。一个
AppBarLayout
扩展LinearLayout
-只需将你的RelativeLayout
添加到你的CollingToolBarLayout
下面,并且不包括任何layout\u滚动标记
<AppBarLayout>
<CollapsingToolbarLayout />
<RelativeLayout />
</AppBarLayout>
这非常完美,修复了我一直想做好的许多事情