在Android Lollipop上拖放不起作用

时间:2015-01-09 16:08:50

标签: android drag-and-drop

此代码适用于所有Android版本,除了5.0及以上......无法找出原因。

findViewById(square).setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View view, final MotionEvent motionEvent) {

            if (motionEvent.getAction()==MotionEvent.ACTION_DOWN) {

                 View.DragShadowBuilder dsb = new View.DragShadowBuilder(shadowStage);
                 view.startDrag(ClipData.newPlainText("", ""), dsb, view, 0);

                         }
                } // shadowStage is a linearLayout cast as a view which contains the shadow image
          }   //square is a linearLayout touched by the user representing a chess square

来自Google Play上的Grandmaster Chess Puzzles。注意到最近出现了一些明星评论,因为它不适用于最新的设备,我想停止它。提前谢谢。

0 个答案:

没有答案