DragImageView

Additional

Language
Java
Version
v1.0 (Mar 9, 2016)
Created
Oct 13, 2015
Updated
Mar 10, 2016 (Retired)
Owner
Jay.Fang (JayFang1993)
Contributor
Jay.Fang (JayFang1993)
1
Activity
Badge
Generate
Download
Source code

DragImageView

一个可拖拽变换的Imageview,且可以使其他组件伴随变换

How To Use

  • 1.add dependency
 allprojects {
  repositories {
   ...
   maven { url "https://jitpack.io" }
  }
 }
 dependencies {
         compile 'com.github.JayFang1993:DragImageView:v1.0'
 }
  • 2.每一层必须要用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>
  • 3.每一层布局对应一个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) {

            }
        });
  • More... see example

使用此项目的应用有:

  • 如果宠物

License

Copyright 2015 JayFang, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.