gpt4 book ai didi

Android 两层重叠滚动布局类似 Airbnb 房间细节布局

转载 作者:太空狗 更新时间:2023-10-29 13:57:23 25 4
gpt4 key购买 nike

我想要像 Airbnb 房间细节布局那样的两层重叠滚动布局

类似 Airbnb 的重叠滚动: enter image description here


但是我的 XML 布局文件输出以下结果:

enter image description here


这是我的布局代码:

<android.support.design.widget.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="280dp"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
android:src="@drawable/height_360_2" />

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

<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="always">

<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="8dp"
app:cardElevation="8dp"
app:contentPadding="16dp">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lineSpacingExtra="8dp"
android:text="@string/person_intro" />

</android.support.v7.widget.CardView>

</android.support.v4.widget.NestedScrollView>
</FrameLayout>

最佳答案

由于我的评论帮助解决了:

These two seem quite similar to me. Difference that I see is that yours goes all the way to the top, ey? Try adding marginTop="50dp" and seeing if it changes anything.

添加一个正确的 marginTop 修复它:

<android.support.v7.widget.CardView 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
app:cardElevation="8dp"
app:contentPadding="16dp">

关于Android 两层重叠滚动布局类似 Airbnb 房间细节布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38400798/

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