效果图
步骤:
1.布局中添加分享按钮
2.画出分享页面
3.设置分享页面animator进出动画,并在style.xml中配置
4.MainActivity中添加方法
*画出布局
主页面: 分享页面:
*设置动画效果
//in.xml//out.xml //styles.xml
*MainActivity添加方法
public void share(View view) { View shareView = LayoutInflater.from(this).inflate(R.layout.popupwindow_share, null); PopupWindow popupWindow = new PopupWindow(shareView, LinearLayout.LayoutParams.MATCH_PARENT,200); popupWindow.setOutsideTouchable(true); popupWindow.setFocusable(true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.setAnimationStyle(R.style.my_popupWindow_style); popupWindow.showAtLocation(view, Gravity.BOTTOM,0,0);}