AndroidSweetBehavior 实践1

作者: 轻微 | 来源:发表于2015-11-20 03:21 被阅读853次

dim.red

效果图:

效果图.gif

github 直达

通过自定义Behavior 和 Nest 事件,达到 instagram 选择照片的的效果.
关于Behavior 和 Nest 事件的学习可以看一下我之前写的学习笔记1 [捂脸]

使用方法也是很简单.

gradle

/build.gradle

repositories {
    maven {
        url "https://jitpack.io"
    }
}

/app/build.gradle

compile 'com.github.zzz40500:AndroidSweetBehavior:0.1.1' 

布局中:



<android.support.design.widget.CoordinatorLayout android:id="@+id/coordinatorLY"
                                                 xmlns:android="http://schemas.android.com/apk/res/android"
                                                 xmlns:app="http://schemas.android.com/apk/res-auto"
                                                 android:layout_width="match_parent"
                                                 android:layout_height="match_parent"
                                                 android:background="#fff"
                                                 android:fitsSystemWindows="false">
    <android.support.design.widget.AppBarLayout
        android:id="@+id/appBarLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="false"
        app:layout_behavior="@string/InAppBarLayout"
        >
        <com.mingle.widget.ScaleLayout
            android:layout_width="match_parent"
            android:layout_height="450dp"
            android:background="#0000"
            android:minHeight="200px"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            app:scaleProvideX="1"
            app:scaleProvideY="1"
            >
            <ImageView
                android:id="@+id/contentIv"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:scaleType="centerCrop"/>
        </com.mingle.widget.ScaleLayout>
    </android.support.design.widget.AppBarLayout>
    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:clipToPadding="false"
        app:layout_behavior="@string/InNestChild"/>
</android.support.design.widget.CoordinatorLayout>

在AppBarLayout 上指定app:layout_behavior="@string/InAppBarLayout"
在RecyclerView 中指定app:layout_behavior="@string/InNestChild"
同时在ScaleLayout 中指定"scroll|exitUntilCollapsed"
并且指定android:minHeight="200px"
这个值表示当 AppBarLayout 收起来的时候,留在屏幕上的高度.

Demo 中使用技术:

第三方库:

https://github.com/zzz40500/ScaleLayout 用于设置宽高比的
glide :用于设置图片的.
https://github.com/tianzhijiexian/CommonAdapter 用于快速建 立RV适配器.

第三方代码:

学习笔记web 页的loading 效果核心代码来至19 的SwipeRefreshLayout中.

实践2待续...

相关文章

  • AndroidSweetBehavior 实践1

    dim.red 效果图: github 直达 通过自定义Behavior 和 Nest 事件,达到 instagr...

  • 实践1

    小棉感冒发烧5天,食欲不振,精神状态也不太好,所幸只是普通感冒。放学时棉儿说想吃天府广场的寿司,要主动“吃饭”我当...

  • 实践(1)

    实践(1) 【背景资料】小关是一个留守儿童,父母常年在外面打工,爷爷奶奶负责照顾他的生活起居。他调皮,不爱学习,基...

  • 暑假工作 ‖ 社会实践报告

    实践时间:2018.07.09—2018.08.25实践人:欧阳广梅实践事件:1.社会实践(爱心传递)2.工作实践...

  • Flask 实践1

    1.一个简单的应用 命令行执行 python app.py浏览器输入:http://localhost:5000/...

  • Flutter 实践1

    China 环境安装 Flutter

  • 爬虫实践1

    1.urllib 1.urllib.urlopen打开一个http链接,返回一个文件描述符 urllib.urlo...

  • 并发实践1

    1 掌握nload命令 和 ab命令 可以看到并发数为10的时候,nload平均为6M 并发数为100的时候,nl...

  • docker 实践1

    使用 wordpress: PHP+MYSQL+WORDPRESS docker run -d -p 90:90 ...

  • Redux实践(1)

    redux 新的尝试 normalizr redux-actions redux-persist redux-th...

网友评论

本文标题:AndroidSweetBehavior 实践1

本文链接:https://www.haomeiwen.com/subject/zgplhttx.html