public void setPosition(Position position) {
this.position = position;
if (position == Position.BOTTOM) {
if (getLayoutParams() instanceof FrameLayout.LayoutParams) {
((LayoutParams) getLayoutParams()).gravity = Gravity.BOTTOM;
} else if (getLayoutParams() instanceof RelativeLayout.LayoutParams) {
((RelativeLayout.LayoutParams) getLayoutParams()).addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
}
setAnimationInterpolator(new LinearInterpolator(), null);
} else {
if (getLayoutParams() instanceof FrameLayout.LayoutParams) {
((LayoutParams) getLayoutParams()).gravity = Gravity.TOP;
} else if (getLayoutParams() instanceof RelativeLayout.LayoutParams) {
((RelativeLayout.LayoutParams) getLayoutParams()).addRule(RelativeLayout.ALIGN_PARENT_TOP);
}
setAnimationInterpolator(new BounceInterpolator(), null);
}
}
Toast.java 文件源码
java
阅读 43
收藏 0
点赞 0
评论 0
项目:ToastBar
作者:
评论列表
文章目录