从一种形状变成另一种形状。
你可以轻易的继承MorphingButton来添加自己的行为(behaviour),下面是一个继承自MorphingButton的ofLinearProgressButton。
示例代码// sample demonstrate how to morph button to green circle with icon
MorphingButton btnMorph = (MorphingButton) findViewById(R.id.btnMorph);
// inside on click event
MorphingButton.Params circle = MorphingButton.Params.create()
.duration(500)
.cornerRadius(dimen(R.dimen.mb_height_56)) // 56 dp
.width(dimen(R.dimen.mb_height_56)) // 56 dp
.height(dimen(R.dimen.mb_height_56)) // 56 dp
.color(color(R.color.green)) // normal state color
.colorPressed(color(R.color.green_dark)) // pressed state color
.icon(R.drawable.ic_done); // icon
btnMorph.morph(circle);
集成
本库没有发布到Maven Centraldependencies {
compile 'com.github.dmytrodanylyk.android-morphing-button:library:1.0.0'
}