上拉滑动拖出控件 scrolllayout

本文介绍如何使用ScrollLayout实现类似地图底部上拉滑动的效果。内容包括集成步骤、布局配置以及代码控制,同时强调在设置监听和滑动布局背景透明的重要性。
摘要由CSDN通过智能技术生成

最近UI设计了这样一个效果 仿照地图底部上拉滑动拖出布局

在网上经过调查 发现scrolllayout这个轮子 下面讲如何使用

1.集成

//向上滑动抽屉
implementation 'com.yinglan.scrolllayout:scrolllayout:1.0.2'

2.布局

<FrameLayout 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"
    tools:context="xxx.xxx.xxx.view.home.facilitator.main.MainFragment">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <com.amap.api.maps.MapView
                android:id="@+id/id_main_map"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

            <ImageView
                android:id="@+id/id_main_skip"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="right"
                android:padding="@dimen/dp_10"
                android:src="@drawable/bg_home_customer" />

            <com.yinglan.scrolllayout.ScrollLayout
                android:id="@+id/scroll_down_layout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginLeft="@dimen/dp_10"
                android:layout_marginRight="@dimen/dp_10"
                android:background="@color/transparent"
                app:allowHorizontalScroll="true"
                app:exitOffset="0dp"
                app:isSupportExit="true"
                app:maxOffset="280dp"
                app:minOffset="80dp"
                app:mode="open">

                <com.yinglan.scrolllayout.content.ContentScrollView
                    android:id="@+id/content_scroll_layout"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:orientation="vertical">

                        <LinearLayout
                            android:id="@+id/id_ll_open"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:orientation="vertical">

                            <LinearLayout
                                android:padding="@dimen/dp_10"
                                android:background="@drawable/bg_item_size"
                                android:layout_width="match_parent"
                                android:layout_height="match_parent"
                                android:orientation="vertical">

                                <LinearLayout
                                    android:layout_width="match_parent"
                                    android:layout_height="wrap_content">

                                    <LinearLayout
                                        android:layout_width="0dp"
                                        android:layout_height="wrap_content"
                                        android:layout_weight="1"
                                        android:orientation="vertical">

                                        <TextView
                                            android:layout_width="match_parent"
                                            android:layout_height="wrap_content"
                                            android:text="告警信息"
                                            android:textColor="@color/text_black"
                                            android:textSize="14sp" />
                                    </LinearLayout>

                                    <LinearLayout
                                        android:layout_width="0dp"
                                        android:layout_height="wrap_content"
                                        android:layout_marginLeft="@dimen/dp_10"
                                        android:layout_weight="1"
                                        android:orientation="horizontal">

                                        <LinearLayout
                                            android:layout_width="0dp"
                                            android:layout_height="wrap_content"
                                            android:layout_weight="1"
                                            android:orientation="vertical">

                                            <TextView
                                                android:id="@+id/id_main_tmonth"
                                                android:layout_width="wrap_content"
                                                android:layout_height="match_parent"
                                                android:layout_gravity="right"
                                                android:background="@drawable/staff_bg_blue_trans"
                                                android:padding="5dp"
                                                android:text="@string/main_thismonth"
                                                android:textColor="@color/colorWhite" />
                                        </LinearLayout>

                                        <LinearLayout
                                            android:layout_width="wrap_content"
                                            android:layout_height="wrap_content"
                                            android:orientation="vertical">

                                            <TextView
                                                android:id="@+id/id_main_pmonth"
                                                android:layout_width="wrap_content"
                                                android:layout_height="wrap_content"
                                                android:layout_gravity="right"
                                                android:background="@drawable/staff_bg_gray_trans"
                                                android:padding="5dp"
                                                android:text="@string/main_previous"
                                                android:textColor="@color/text_tip" />
                                        </LinearLayout>
                                    </LinearLayout>
                                </LinearLayout>

                         
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值