您当前的位置: 首页 >  动画

BottomDialog 是一个通过 DialogFragment 实现的底部弹窗布局,并且支持弹出动画,支持任意布局http://shaohui.me

发布时间:2016-10-18 14:26:35 ,浏览量:0

BottomDialog
项目地址: shaohui10086/BottomDialog
简介:BottomDialog 是一个通过 DialogFragment 实现的底部弹窗布局,并且支持弹出动画,支持任意布局 http://shaohui.me

build license

中文版

BottomDialog is a bottom dialog layout implemented with DialogFragment,And supports pop-up animation, support any layout

Preview

BottomDialogShare BottomDialogShare

Import

Maven

me.shaohuibottomdialog1.1.9pom

or Gradle

compile 'me.shaohui:bottomdialog:1.1.9'
Uasge

You can use BottomDialog in two different ways :

1.Use directly BottomDialog

A simple three lines of code can be done:

BottomDialog.create(getSupportFragmentManager())
                .setLayoutRes(R.layout.dialog_layout)      // dialog layout
                .show();

Of course, you can also make simple settings:

BottomDialog.create(getSupportFragmentManager())
                .setViewListener(new BottomDialog.ViewListener() {    
                    @Override
                    public void bindView(View v) {
                        // // You can do any of the necessary the operation with the view
                    }
                })
                .setLayoutRes(R.layout.dialog_layout)  
                .setDimAmount(0.1f)            // Dialog window dim amount(can change window background color), range:0 to 1,default is : 0.2f
                .setCancelOutside(false)     // click the external area whether is closed, default is : true
                .setTag("BottomDialog")     // setting the DialogFragment tag
                .show();

So Easy!

2.or extends BaseBottomDialog to use

First of all, according to your needs to define a class,extends BaseBottomDialog,For example belowShareBottomDialog

public class ShareBottomDialog extends BaseBottomDialog{

    @Override
    public int getLayoutRes() {
        return R.layout.dialog_layout;
    }

    @Override
    public void bindView(View v) {
        // do any thing you want
    }
}

So simple, only two abstract methods needed to achieve, the rest is to add your logic. Of course, you can also rewrite some of the necessary methods to meet your needs, You can manipulate this Dialog as you would a Fragment

int getHeight()                 // return your bottomDialog height

float getDimAmount()            // set dialog dim amount(can change window background color), default is 0.2f

boolean getCancelOutside()      // click the external area whether is closed, default is : true

String getFragmentTag()         // set dialogFragment tag

The rest is use it:

ShareBottomDialog dialog = new ShareBottomDialog();
    dialog.show(getFragmentManager());

That is all!

Issue

If you are in the process of using, encountered any problems, welcome to put forward issue

关注
打赏
1688896170
查看更多评论

暂无认证

  • 0浏览

    0关注

    111322博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.0523s