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

简介: 现在仿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>

目录
相关文章
|
druid Java 数据库连接
|
SQL 双11 流计算
Flink SQL 功能解密系列 —— 流计算“撤回(Retraction)”案例分析
通俗讲retract就是传统数据里面的更新操作,也就是说retract是流式计算场景下对数据更新的处理方式。
|
4月前
|
人工智能 JSON 自然语言处理
【北京】不会敲代码也能用AI?零门槛云客服系统,一键解决80%重复咨询
“不会代码”已不再是中小企业落地AI客服的障碍。当前主流的云客服系统已将AI能力封装为可视化配置模块——通过拖拽式知识库构建、预置NLP模型和流程画布,业务人员可以像搭积木一样搭建一套能自动回答80%重复咨询的智能客服系统。本文从零代码AI客服的技术架构(FAQ知识库+意图识别+多轮对话引擎)、知识库的冷启动与持续优化方法、人机协作的无感切换机制及效果量化评估四个维度,系统拆解一套非技术团队也能掌握的AI客服落地方案。文中所有技术实现均标注了能力边界和适用场景,可作为北京中小企业从0到1搭建智能客服的技术参考。
352 0
【北京】不会敲代码也能用AI?零门槛云客服系统,一键解决80%重复咨询
|
8月前
|
人工智能 安全 机器人
Hermes Agent、聊天机器人和 Copilot 的区别,应该先看工作流
围绕 AI Hermes Agent FAQ 页,拆解为什么比较 chatbot、coding copilot 和 long-running agent 时,应该先看工作形态和部署边界,而不是直接做优劣判断。
|
8月前
|
编解码 自然语言处理 安全
无接口也能通:实在Agent如何用ISSUT屏幕语义技术打通企业异构系统孤岛
实在Agent首创ISSUT屏幕语义理解技术,不依赖API,像人一样“看懂”并操作各类系统界面(SAP/钉钉/网银/老旧OA等),自动完成跨系统数据搬运与流程闭环,破解企业“系统孤岛”难题,开箱即用,安全合规。(239字)
|
9月前
|
JSON 运维 安全
接入Claude on Bedrock,我遇到的4个注意事项
本项目基于Amazon Bedrock调用Anthropic Claude Sonnet,实现企业级PDF文档关键信息抽取与摘要生成。依托其8万token长上下文、原生多模态及强安全对齐能力,在VPC内网链路中保障数据不出域,兼顾合规性与工程效率。
725 0
|
算法 测试技术 vr&ar
Unity Vufoia+AR模型抖动的问题
**图像识别与跟踪精度问题**:Vuforia 依赖特征点检测,环境光线不稳定、目标纹理不丰富或遮挡会导致特征点匹配误差,引起AR模型抖动。跟踪丢失和重定位延迟也会导致模型不稳定。 **设备硬件与性能问题**:移动设备摄像头易受手持抖动影响,低性能设备无法及时处理图像数据,导致跟踪结果更新延迟。 **模型与坐标系问题**:AR模型重心设置不合理或坐标系转换误差,会使模型在虚拟空间中不稳定。 **算法与参数设置问题**:跟踪算法局限性和参数设置不合理(如灵敏度过高或平滑度过低)都会影响跟踪稳定性。 。
|
存储 程序员 C语言
c语言的烫烫烫烫烫??
当初学习C语言时,对于一些特殊的打印输出可能会感到困惑,比如会出现一堆乱码烫烫烫的情况。这样做的好处是这些值都很大,作为指针是不可能的(而且 32 位系统中指针很少是奇数值,在有些系统中奇数的指针会产生运行时错误),作为数值也很少遇到,而且这些值也很容易辨认,因此这很有利于在 Debug 版中发现 Release 版才会遇到的错误。但是学的比较深的同学就会里面反应过来这个代码其实是有问题的,因为在字符数组里面,最后一位没有存储''\0'',所以在打印的时候不会遇见特殊结束标识符,不会停止打印;
644 0
|
边缘计算 自动驾驶 5G
5G网络架构解析:从核心网到边缘计算
【10月更文挑战第24天】
1261 10
|
机器学习/深度学习 人工智能 算法
【AI系统】AI系统概述与设计目标
本文介绍了AI系统的全栈架构,涵盖设计目标、组成和生态。AI系统旨在连接硬件与应用,提供高效的模型服务和开发支持。文中探讨了高效编程语言、开发框架、工具链的重要性,以及AI任务系统级支持、自动编译优化和云原生自动分布式化等关键设计目标。此外,还详细讨论了AI训练与推理框架、AI编译与计算架构、AI硬件与体系结构等组成部分,以及AI算法和框架、更广泛的生态系统等。
1116 1