title: How can I drag a view horizontally?
body: <p>In controls like ListView and Gallery you can drag items in one direction vertical or horizontal.</p>
  
  <p>I have a TextView that I drag it successfully. But I want to move it in horizontal direction. how can i implement it?</p>
  
  <p>Thanks,</p>
  
  <p>my code:</p>
  
  <pre><code>public class MyDragShadowBuilder extends View.DragShadowBuilder {
      private static View view;
  
      public MyDragShadowBuilder(View v) {
          super(v);
          view = v;
      }
  
      @Override
      public void onProvideShadowMetrics(Point size, Point touch) {
          width = getView().getWidth();
          height = getView().getHeight();
          size.set(width, height);
          touch.set(width / 2, height / 2);
      }
  
      private int width, height;
  
      @Override
      public void onDrawShadow(Canvas canvas) {
          view.draw(canvas);
      }
  }
  </code></pre>
  
  <p>in my activity:</p>
  
  <pre><code>tv.setOnLongClickListener(new OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
              ClipData data = ClipData.newPlainText("dot",
                      "Dot : " + v.toString());
              View.DragShadowBuilder myShadow = new MyDragShadowBuilder(v);
              v.startDrag(data, myShadow,(Object) v, 0);
              return false;
              }
          });
  </code></pre>
  
  <p>I want to simulate a Gallery. I have 10000 photos to show by it. My gallery can show 10 photos. I want to drag the LinearLayout of my gallery which is containing the gallery's content horizontally and when the LinearLayout reached to the end of window like SlidingDrawer, change its content and show the next 10 photos. SlidingDrawer is a good solution but it has some limitations. When you set your whole LinearLayout as its <strong>handle</strong> it can not be clicked. When you set a separated <strong>handle</strong> for it, you can not determine the position of <strong>handle</strong> relative to the <strong>content</strong>.</p>