• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

roiacult/BackdropLayout: this library is based on Material design guidance

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

roiacult/BackdropLayout

开源软件地址(OpenSource Url):

https://github.com/roiacult/BackdropLayout

开源编程语言(OpenSource Language):

Kotlin 90.1%

开源软件介绍(OpenSource Introduction):

BackdropLayout

this library is based on Material design guidance (https://material.io/design/components/backdrop.html)

alt alt

Requirements

  • api 16 or higher
  • migrating to androidx

Setting up

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency in your app build.gradle file

dependencies {
	...
    implementation 'com.github.roiacult:BackdropLayout:VERSION'
}

Note : replace VERSION with latest version from jitpack

Usage

you need to include front and back layout inside backdropLayout and specifie front_layout and back_layout attribute or it will throw an exception

    <com.roacult.backdrop.BackdropLayout
            android:id="@+id/container"
            app:front_layout="@id/includedFront"
            app:back_layout="@id/includedBack"
            app:toolbarId="@id/toolbar"
            app:peekHeight="56dp"
            app:disable_when_open="true"
            app:menuDrawable="@drawable/ic_menu"
            app:closeDrawable="@drawable/ic_close"
            app:animationDuration="400"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        <include
                android:id="@+id/includedBack"
                layout="@layout/back_layout"/>
        <include
                android:id="@+id/includedFront"
                layout="@layout/front_layout"/>

    </com.roacult.backdrop.BackdropLayout>

app:front_layout : id of front layout (required)

app:back_layout : id of back layout (required)

app:toolbarId : id of toolbar when this attribute is specified BackdropLayout will automatically handle click event on toolbar and change state of backdroplayout and navigation icon according to the click

app:peekHeight : height of front layout header if not specified BackdropLayout will swip front layout out of screen when BackdropLayout is in open state

app:menuDrawable : drawable shown when BackdropLayout is in close State

app:closeDrawable : drawable shown when BackdropLayout is in open State

app:animationDuration : duration of swiping front layout

app:disable_when_open : disable front layout and adding white (Transparent) view above front layout

app:front_header_radius : if your front layout header have corner radius and you set app:disable_when_open to true you should set this attribute to same radius value of your front layout header to prevent disablingView (White Transparent above FrontLayout) from overlapping the Frontlayout

// you can add listener
backdropLayout.setOnBackdropChangeStateListener{
    when(it){	
       BackdropLayout.State.OPEN -> {
            //TODO 
       }
       BackdropLayout.State.CLOSE -> { 
	    //TODO 
       }
    } 	 
}

// you can access front and back layout
backdropLayout.getFrontLayout()
backdropLayout.getBackLayout()
	

for more information see simple app included in this repo (https://github.com/roiacult/BackdropLayout/tree/master/app)

contact

alt text




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap