Skip to content

lkkz/ElasticDialog

Repository files navigation

ElasticDialog

一个弹性dialog

效果图

Image text

如果你是AndroidStudio用户,在build.gradle中添加

compile 'com.cool:elasticdialog:1.0.0'

使用

  • 初始化

      private void initDialog() {
      if(elasticDialog== null) {
          elasticDialog = new ElasticDialog(this);
          elasticDialog.layout(R.layout.dialog_elastic)
                  .arcColor(Color.WHITE)
                  .duration(1000)
                  .arcHight(40);
          mRecyclerView = elasticDialog.findViewById(R.id.recyclerview);
      	}
      }
    

    布局文件dialog_elastic.xml

      <?xml version="1.0" encoding="utf-8"?>
      <FrameLayout xmlns:android="http://	schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
      	<android.support.v7.widget.RecyclerView
      		android:id="@+id/recyclerview"
      		android:layout_width="match_parent"
      		android:layout_height="300dp"
      		android:layout_gravity="bottom">
    
      </android.support.v7.widget.RecyclerView>
    
  • 调用

      elasticDialog.show();  
    

    有两点需要注意

  • 布局文件dialog_elastic子View需要设置android:layout_gravity="bottom"属性

  • 根布局使用FrameLayout 博客地址:

封装弹性dialog框架,使用只需一行代码

封装弹性dialog框架,使用只需一行代码

About

弹性dialog

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages