1.先看一下效果图
动图还不会上传,各位凑合着看吧,意思和微信的那个长按应该是一样的
![尴尬](http://static.blog.csdn.net/xheditor/xheditor_emot/default/awkward.gif)
2.上代码
public class TestActivity extends Activity implements View.OnLongClickListener, View.OnTouchListener { private Button mTopMBtn; private Button mBottomMBtn; private RelativeLayout mRelativeLayout; private int mWindowHeight; private int mParentHeight; private int mViewHeight; private int mTitleHeight; private int mDialogHeight; private int point_width; private Activity mActivity; private PopupWindow mPopupWindow; private View dialogView; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_test);