悬浮指示器布局-利用协调器布局

简介: 现在仿360手机助手,简书布局效果的案例,越来越多,之前我写过FloatIndicatorLayout,发出来之后,还是有不少朋友在看,也有朋友告诉我可以用CoordinatorLayout去实现这个效果,之前对协调器布局了解的比较少,这两天抽空看了...

现在仿360手机助手,简书布局效果的案例,越来越多,之前我写过FloatIndicatorLayout,发出来之后,还是有不少朋友在看,也有朋友告诉我可以用CoordinatorLayout去实现这个效果,之前对协调器布局了解的比较少,这两天抽空看了一下,不仅感慨,还是谷歌的大神牛逼!

先看png预览,这里是 gif效果图源码

Paste_Image.png

再看代码

<pre>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cool="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/co_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<android.support.design.widget.AppBarLayout
    android:id="@+id/ab_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/co_to_layout"
        android:layout_width="match_parent"
        android:layout_height="270dp"
        android:background="#DD009688"
        cool:collapsedTitleTextAppearance="@style/ToolBarTitleText"
        cool:contentScrim="#009688"
        cool:expandedTitleMarginEnd="48dp"
        cool:expandedTitleMarginStart="48dp"
        cool:expandedTitleTextAppearance="@style/transparentText"
        cool:layout_scrollFlags="scroll|enterAlways">
        <!-- cool:layout_scrollFlags="scroll|exitUntilCollapsed"-->


        <LinearLayout
            android:id="@+id/layout_head"
            cool:layout_collapseMode="pin"
            cool:layout_collapseParallaxMultiplier="0.7">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="50dp"
                android:padding="20dp">

            
            </RelativeLayout>
        </LinearLayout>

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            cool:layout_collapseMode="pin"
            cool:popupTheme="@style/ThemeOverlay.AppCompat.Light"
            cool:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>

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

    <View
        android:layout_width="match_parent"
        android:layout_height="0.5dp"
        android:background="#EE009688"/>

    <github.hellojp.tabsindicator.TabsIndicator
        xmlns:tabsIndicator="http://schemas.android.com/apk/res-auto"
        android:id="@+id/ti"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_gravity="bottom"
        android:background="#009688"
        tabsIndicator:dividerColor="#E0F2F1"
        tabsIndicator:dividerVerticalMargin="10dp"
        tabsIndicator:dividerWidth="2dp"
        tabsIndicator:hasDivider="true"
        tabsIndicator:lineColor="#00695C"
        tabsIndicator:lineHeight="2dp"
        tabsIndicator:lineMarginTab="20dp"
        tabsIndicator:linePosition="bottom"
        tabsIndicator:textBackgroundResId="@drawable/selector_view_tabs_item"
        tabsIndicator:textColor="@drawable/selector_tab"
        tabsIndicator:textSizeNormal="14sp"
        tabsIndicator:textSizeSelected="18sp"/>
</android.support.design.widget.AppBarLayout>


<android.support.v4.view.ViewPager
    android:id="@+id/vp"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    cool:layout_behavior="@string/appbar_scrolling_view_behavior"/>

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

<pre>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:ignore="ContentDescription,UselessParent">

<github.aspsine.swipetoloadlayout.SwipeToLoadLayout
    xmlns:swipeToLoadLayout="http://schemas.android.com/apk/res-auto"
    android:id="@+id/stll"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    swipeToLoadLayout:default_to_loading_more_scrolling_duration="500"
    swipeToLoadLayout:default_to_refreshing_scrolling_duration="1000"
    swipeToLoadLayout:load_more_complete_delay_duration="0"
    swipeToLoadLayout:load_more_final_drag_offset="@dimen/load_more_final_offset_google"
    swipeToLoadLayout:load_more_trigger_offset="@dimen/load_more_trigger_offset_google"
    swipeToLoadLayout:refresh_complete_delay_duration="0"
    swipeToLoadLayout:refresh_final_drag_offset="@dimen/refresh_final_offset_google"
    swipeToLoadLayout:refresh_trigger_offset="@dimen/refresh_trigger_offset_google"
    swipeToLoadLayout:swipe_style="above">

    <include
        android:id="@id/swipe_refresh_header"
        layout="@layout/layout_google_hook_header"
        />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/swipe_target"
        tools:listitem="@layout/item_fragment_game_before_score"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <include
        android:id="@id/swipe_load_more_footer"
        layout="@layout/layout_google_footer"
        />

</github.aspsine.swipetoloadlayout.SwipeToLoadLayout>

</LinearLayout>
</pre>

目录
相关文章
|
10月前
|
人工智能 自然语言处理 搜索推荐
上下文学习的神奇魔法:轻松理解AI如何无师自通
你有没有想过,为什么给GPT几个例子,它就能学会新任务?这就像魔法一样!本文用轻松幽默的方式解密上下文学习的原理,通过「智能客服训练」场景,带你理解AI如何像人类一样从示例中学习,无需额外训练就能掌握新技能。
387 28
|
10月前
|
运维 Kubernetes 数据可视化
helm-diff:显示Helm升级变更的diff插件
helm-diff:Helm插件,解决Kubernetes应用升级前难以知晓具体资源变更的痛点。通过生成当前部署版本与升级计划的差异对比,将抽象升级操作转化为可视化资源变更,支持升级前预览,让每一次变更清晰可见,提升应用管理可控性。
488 5
|
11月前
|
机器人 数据安全/隐私保护 Python
微信自动转发机器人,微信群自动发消息机器人,微信全自动群发软件
展示一个使用Python进行基础网页自动化的示例代码,仅供学习自动化技术原理使用。
|
存储 算法 安全
硬盘数据恢复——硬盘固件区损坏的数据恢复方案
硬盘故障: 硬盘固件区损坏。 硬盘固件区损坏的故障表现: 1、硬盘寻道正常但无法正确识别自身型号或容量。 2、硬盘可以正常识别自身型号和容量但无法读取。
|
存储 SQL BI
毫秒级查询性能优化实践!基于阿里云数据库 SelectDB 版内核:Apache Doris 在极越汽车数字化运营和营销方向的解决方案
毫秒级查询性能优化实践!基于阿里云数据库 SelectDB 版内核:Apache Doris 在极越汽车数字化运营和营销方向的解决方案
2331 1
毫秒级查询性能优化实践!基于阿里云数据库 SelectDB 版内核:Apache Doris 在极越汽车数字化运营和营销方向的解决方案
|
消息中间件 数据库
Seata框架的工作原理
你还可以进一步深入研究 Seata 框架的技术细节和具体实现,以更好地理解其工作原理和优势。同时,结合实际应用场景进行实践和优化,也是提高分布式事务处理能力的重要途径。
822 168
|
云安全 监控 安全
AWS 云安全深度剖析:如何有效监测 SSH 暴力攻击
云基础设施多由基于Linux的机器主导,因其开源、低成本、可靠性和灵活性。然而,这些机器易受黑客攻击,尤其是通过SSH通道。SSH(安全外壳协议)用于加密连接,确保远程登录和文件传输的安全性。在AWS中,管理员通过SSH保护Linux实例的远程访问,但暴露SSH服务会增加暴力破解风险。攻击者利用暴力破解程序尝试获取访问权限,进而感染主机或窃取数据。为防御此类攻击,建议使用SIEM解决方案监控日志,检测异常登录行为,并阻止可疑IP地址。此外,避免公开暴露SSH服务,添加双因素身份验证等额外安全层,以增强云安全性。
392 17
|
运维 Linux 数据安全/隐私保护
统信-龙蜥技术认证培训专场
在2024龙蜥大会中,本次分享的主题是龙蜥技术认证培训的相关内容。 1.课前准备 2.课程介绍 3.服务器操作系统 4.蜥基础课程讲解 5.现场考试
516 14
|
前端开发 算法 Java
软考软件设计师-备考须知
jong&gt;✨ 潜意识Java:个人主页 ✨ 座右铭:得之坦然,失之淡然。擅长前端开发。分享软考软件设计师备考经验,涵盖考试意义、复习方法及学习资源推荐。专栏持续更新中,提供最新最全的备考指南!欢迎点赞、关注、收藏,您的支持是我前进的动力! 目录包括作者声明、备考理由、个人建议及学习方法,助你高效备考。特别推荐B站视频课程和历年真题刷题。
503 1
|
编解码 前端开发 API
使用 DPR 进行响应式设计
【10月更文挑战第24天】我们可以利用 DPR 来实现更精细、更自适应的响应式设计,为用户提供更好的视觉体验,无论他们使用的是什么设备。