一個可拖拽變換的Imageview,且可以使其他組件伴隨變換:DragImageView

jopen 9年前發布 | 11K 次閱讀 Android開發 移動開發 DragImageView
一個可拖拽變換的Imageview,且可以使其他組件伴隨變換
 

使用說明:


  • 1.每一層必須要用Fragment嵌套DragImageView,如果該層還有其他布局,也要在Fragment內,如果該布局需要隨DragImageView共同變換的話,需要嵌套在RotateRelativeLayout內。

    <FrameLayout
        android:id="@+id/fl_bottom"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <info.fangjie.dragimageview.DragImageView
            android:layout_width="fill_parent"
            android:id="@+id/dragview_bottom"
            android:background="#00ffffff"
            android:src="@drawable/cute_or_not_default"
            android:layout_height="fill_parent" />

        <info.fangjie.dragimageview.RotateRelativeLayout
            android:layout_width="fill_parent"
            android:id="@+id/rl_bottom"
            android:layout_height="fill_parent">
            <TextView
                android:layout_width="wrap_content"
                android:gravity="left"
                android:id="@+id/tv_mark_bottom"
                android:textSize="16sp"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="60dp"
                android:textColor="#ffffff"
                android:layout_height="wrap_content" />
        </info.fangjie.dragimageview.RotateRelativeLayout>
    </FrameLayout>
  • 2.每一層布局對應一個LayerView

public class MyLayerView extends BaseLayerView {

    MyLayerView(int layerOrder){
        super(layerOrder);
    }

    public RotateRelativeLayout relativeLayout;

    public TextView textView;

}
  • 3.每層的DragImagview需要實現 DragListener,實現事件響應。

        layerViewBottom.dragImageView.setDragListener(new DragListener() {
            @Override
            public void onDrag(Matrix matrix, int state) {

            }

            @Override
            public void onDragOutFinish(int direction) {

            }

            @Override
            public void onDragOut(int direction) {

            }

            @Override
            public void onDragReset(int direction) {

            }
        });

項目主頁:http://www.baiduhome.net/lib/view/home/1446619291732

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!