Coder Social home page Coder Social logo

stickylayout's Introduction

#StickyLayout

相关介绍博文

一个Android中拥有黏性头部的滑动布局,整体布局内容滑动和列表滑动完美切换,惯性传递的自定义控件。

gif

##How to use

这不是一个第三发库,只是根据需求对 Android 的触摸事件的一次实践, StickyLayout 继承自 LinearLayout 嵌套在头布局和列表布局的最外层即可,使用起来非常简单。

<com.licrafter.scrolllayout.view.StickyLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#ffffff"
        android:clickable="true"
        android:orientation="vertical">

        <ImageView
            android:id="@+id/header01"
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:background="#50ae"
            android:clickable="true"
            android:scaleType="centerCrop"/>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <View
                android:background="#eb4f38"
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:layout_height="wrap_content"/>

            <View
                android:background="#ea8010"
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:layout_height="wrap_content"/>

            <View
                android:background="#f4c600"
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:layout_height="wrap_content"/>

            <View
                android:background="#9d55b8"
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:layout_height="wrap_content"/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="120dp"
            android:background="#50de"
            android:clickable="true">

            <ImageView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:src="@mipmap/bg_01"/>
        </LinearLayout>

        <android.support.design.widget.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
    </LinearLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/goodsViewPager"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"/>

</com.licrafter.scrolllayout.view.StickyLayout>

stickylayout's People

Contributors

shellljx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.