切割式、断头台式view弹出效果
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
implementation 'com.github.yoyoyaobin:GuillotineView:1.0.0'
GuillotineView.GuillotineBuilder(this)
...
.build()
var view = findViewById<View>(R.id.toplayout)
var titleLeftBtn = view.findViewById<ImageView>(R.id.iv_leftbtn)
var myGuillotineView = LayoutInflater.from(this).inflate(R.layout.guillotine_layout ,null)
var tvTitle = myGuillotineView.findViewById<TextView>(R.id.tv_title)
tvTitle.text = "GuillotineView"
var guillotineViewleftBtn = myGuillotineView.findViewById<ImageView>(R.id.iv_leftbtn)
GuillotineView.GuillotineBuilder(this)
.setGuillotineView(myGuillotineView)//设置弹出view
.setCloseItemView(guillotineViewleftBtn)//设置关闭view的触发按钮
.setOpenItemView(titleLeftBtn)//设置开启view的触发按钮
.setClosedOnStart(true)//是否默认关闭
.setIsLeftBtn(true)//触发按钮为左边
.build()
1.首页layout根布局需要为FrameLayout(弹出的view则不限制)
2.允许自定义插值器,可以使用setInterpolator()设置
3.首页跟弹出view的两个按钮最好是相同位置,效果最佳(比如两个layout都复用了相同的topbar)
2.触发按钮在左边,则设置setIsLeftBtn,反之则设置setIsRightBtn
详见LICENSE