支持手勢拉大和拉小的Android ImageView:GestureImageView

jopen 10年前發布 | 39K 次閱讀 Android開發 移動開發 GestureImageView

GestureImageView實現了一個支持手勢縮放,旋轉,平移的Android ImageView。
配置成layout.xml中的一個view

<LinearLayout
    xmlns:android="

<com.polites.android.GestureImageView
    android:id="@+id/image"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/image"
    gesture-image:min-scale="0.1"
    gesture-image:max-scale="10.0"
    gesture-image:strict="false"/>

</LinearLayout></pre>

編程的方式配置

import com.polites.android.GestureImageView;

import android.app.Activity; import android.os.Bundle; import android.view.ViewGroup; import android.widget.LinearLayout.LayoutParams;

public class SampleActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);

    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    GestureImageView view = new GestureImageView(this);
    view.setImageResource(R.drawable.image);
    view.setLayoutParams(params);

    ViewGroup layout = (ViewGroup) findViewById(R.id.layout);

    layout.addView(view);
}

}</pre>

特性:

  1. Pinch zoom in place (i.e. zoom occurs from point of touch)
  2. Panning with fling gesture
  3. Double tap zoom
  4. Configurable zoom boundaries (min/max)
  5. </ol>

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

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