ScrollView

垂直:ScrollView

横向:HorizontalScrollView

ScrollView外层搭配RelativeLayout更灵活:

  让ScrollView能Height=“match_parent”同时,above底部布局从而不会覆盖底部

 

复制代码
<?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:orientation="vertical"
    tools:context=".ui.activity.ClockActivity">

    <include
        android:id="@+id/top"
        layout="@layout/layout_clock_top"/>

    <RelativeLayout
        android:layout_below="@+id/top"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <ScrollView
            android:layout_above="@+id/fl"
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <com.yanzhenjie.recyclerview.SwipeRecyclerView
                android:layout_above="@+id/fl"
                android:id="@+id/srv"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>

        </ScrollView>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/fl"
            android:background="@color/ad_background_color"
            android:minHeight="185dp"
            android:layout_alignParentBottom="true"/>
    </RelativeLayout>

</RelativeLayout>

复制代码

上面布局意思是对的,但是理解有点问题,让RecyclerView直接above fragment也是能够不覆盖底部的

posted @   remix_alone  阅读(24)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
历史上的今天:
2021-08-31 Android——Glide的使用和Glide缓存问题
2021-08-31 JavaWeb——Idea文件保存路径
2021-08-31 JavaWeb——DiskFileItemFactory
点击右上角即可分享
微信分享提示