gpt4 book ai didi

android - 如何修复 Coordinator Layout 中的布局?

转载 作者:太空宇宙 更新时间:2023-11-03 13:17:07 25 4
gpt4 key购买 nike

当前回收站 View 和应用栏滚动。现在我需要将相对布局 rlProductCheckout 修复到屏幕底部,即使 recyclerview 和应用栏滚动也是如此。当我开始滚动时,当前的相对布局消失,只有当我回到列表的开头时它才会重新出现。

content_products_layout.xml

<?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"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/activity_products_list">



<android.support.v7.widget.RecyclerView
android:id="@+id/rvProductList"
android:layout_above="@+id/rlProductCheckout"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="wrap_content" />


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:gravity="center_vertical"
android:id="@+id/rlProductCheckout"
android:layout_alignParentBottom="true">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Checkout"/>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_menu_send"
android:layout_alignParentRight="true"/>

</RelativeLayout>
</RelativeLayout>

activity_products_layout.xml

<?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"
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.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="@color/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">

<ImageView
android:id="@+id/expandedImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/prod1"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7" />

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin" />


</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_products_list" />



</android.support.design.widget.CoordinatorLayout>

最佳答案

尝试将 RelativeLayout 包裹在 CoordinatorLayout 之外。试试这样的 How to put RelativeLayout inside CoordinatorLayout

关于android - 如何修复 Coordinator Layout 中的布局?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34288148/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com