Android 仿高德地图可拉伸的BottomSheet

项目上要用到类似高德地图搜索结果后的结果展示的可拉伸控件。

这里写图片描述


由于没有找到合适的软件,制作的效果有点差,将就看下。

自己的效果:
这里写图片描述

虽然说效果没有高德的好(就是在下滑的时候不能准确折叠到中间),但是基本满足了项目的需要。如果各位大神有更好的方法,欢迎留言提供方法。

刚开始以为这是抽屉效果(slidingdrawer),结果发现这个类已经被谷歌抛弃,且content也不能滑动,得自定义控件实现。但是我的自定义控件水平不高,苦思一天还是写不出来,只能各种查类似的效果,终于找到了比较接近的CoordinatorLayout。

@deprecated 
This class is not supported anymore. It is recommended you base your own implementation on the source code for the Android Open Source Project if you must use it in your application.

关于CoordinatorLayout — 协调布局 这个新控件我了解的不多,等我找找资料后再写一篇文章。我就先说说效果的实现。
布局文件:

<?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:id="@+id/coordinator"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#88bbbbbb"
    android:gravity="center"
    tools:context="com.joysuch.collapseviewdemo.MainActivity">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/girl"/>

    <RelativeLayout
        android:id="@+id/design_bottom_sheet_bar"
        android:layout_width="match_parent"
  • 6
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值