在Android.You一个轻量级的,灵活的提示对话框中可以自定义对话框风格轻松,设置TipView位置,背景颜色,动画,仅仅只有一行代码!这个项目,并演示是github上开源的。
使用方法如下:
dependencies {
compile 'com.github.michaelye.easydialog:easydialog:1.4'
}
View view = this.getLayoutInflater().inflate(R.layout.layout_tip_content_horizontal, null);
new EasyDialog(MainActivity.this)
// .setLayoutResourceId(R.layout.layout_tip_content_horizontal)//layout resource id
.setLayout(view)
.setBackgroundColor(MainActivity.this.getResources().getColor(R.color.background_color_black))
// .setLocation(new location[])//point in screen
.setLocationByAttachedView(btnTopLeft)
.setGravity(EasyDialog.GRAVITY_BOTTOM)
.setAnimationTranslationShow(EasyDialog.DIRECTION_X, 1000, -600, 100, -50, 50, 0)
.setAnimationAlphaShow(1000, 0.3f, 1.0f)
.setAnimationTranslationDismiss(EasyDialog.DIRECTION_X, 500, -50, 800)
.setAnimationAlphaDismiss(500, 1.0f, 0.0f)
.setTouchOutsideDismiss(true)
.setMatchParent(true)
.setMarginLeftAndRight(24, 24)
.setOutsideColor(MainActivity.this.getResources().getColor(R.color.outside_color_trans))
.show();