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

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
-
上一篇
编译可在Nexus5上运行的CyanogenMod13.0 ROM(基于Android6.0)
编译可在Nexus5上运行的CyanogenMod13.0 ROM (基于Android6.0) 作者:寻禹@阿里聚安全 前言 下文中无特殊说明时CM代表CyanogenMod的缩写。下文中说的“设备”均指Android设备。 proprietary-blobs.txt文件的路径:device/lge/hammerhead/proprietary-blobs.txt 参考资料 How To Build CyanogenMod For Google Nexus 5 (“hammerhead”) 本文中只列出与上面的参考资料中不同的地方,所以需要将上面的参考资料与本文结合起来阅读。 下载CM13.0 ROM repo init -u git://github.com/CyanogenMod/android.git -b cm-13.0 注意事项 构建ROM之前设备上必须先安装相应的ROM 在参考资料中有这么一段话:Note:Your device should already be running a build of CyanogenMod for the branch you wish...
-
下一篇
Android最佳Mock单元测试方案:Junit + Mockito + Powermock
本文旨在从实践出发,引导开发者在Android项目中进行Mock单元测试。 什么是单元测试 单元测试由一组独立的测试构成,每个测试针对软件中的一个单独的程序单元。单元测试并非检查程序单元之间是否能够合作良好,而是检查单个程序单元行为是否正确。 为什么要进行单元测试 在敏捷开发大行其道的今天,由于时间紧,任务重,过分依赖测试工程师以及下列原因,导致单元测试不被重视,在开发流程中处于一个可有可无的尴尬境地。 浪费的时间太多 软件开发人员不应参与单元测试 我是很棒的程序员,不需要进行单元测试 不管怎样,集成测试将会抓住所有的Bug 单元测试效率不高 那么单元测试是否正的可有可无呢?No! No! No! 作为android客户端研发,在一个开发周期内,你负责的需求需要Web服务(API),和本地代码(JNI,Native Code)的支持,而你们的工作是同时进行的。 你的需求开发完成了,但是由于需要在特定条件下才能触发,而这些条件在开发过程中很难去模拟,导致需求无法在所有场景下进行充分测试。举个例子,假设你在室内开发一个地图导航的Android应用,你需要在导航过程中,前方出现车祸,积水,施...
相关文章
文章评论
共有0条评论来说两句吧...