Android使用PhotoView实现图片缩放功能
2013-12-09 21:53
766 查看
使用第三方开源项目,地址:https://github.com/chrisbanes/PhotoView
引入library 项目.
简单的加载一张图片:
[java]
view plaincopy
public class MainActivity extends Activity {
ImageView imgView;
PhotoViewAttacher attacher;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imgView=(ImageView) findViewById(R.id.img);
imgView.setImageResource(R.drawable.wallpaper);
attacher=new PhotoViewAttacher(imgView);
}
}
布局文件:
[html]
view plaincopy
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/img" />
</RelativeLayout>
引入library 项目.
简单的加载一张图片:
[java]
view plaincopy
public class MainActivity extends Activity {
ImageView imgView;
PhotoViewAttacher attacher;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imgView=(ImageView) findViewById(R.id.img);
imgView.setImageResource(R.drawable.wallpaper);
attacher=new PhotoViewAttacher(imgView);
}
}
布局文件:
[html]
view plaincopy
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/img" />
</RelativeLayout>
相关文章推荐
- Android使用Photoview实现图片左右滑动及缩放功能
- Android使用PhotoView实现图片缩放功能
- [置顶] viewPager+photoView实现图片轮播和手势缩放功能 支持手势缩放的imageView 如何实现相册左右滑动和手势缩放 如何让图片自适应控件大小 photoView如何使用(上)
- 使用Photoview实现图片左右滑动及缩放功能
- android 图片浏览功能 图片放大缩小 使用 photoview 双击或双指缩放的ImageView
- Android 使用ViewPager结合PhotoView开源组件实现网络图片在线浏览功能
- Android 使用ViewPager结合PhotoView开源组件实现网络图片在线浏览功能
- Android使用ViewPager、PhotoView实现类似QQ空间图片浏览功能
- 【Android 开发】:UI控件之 ImageView 实现图片旋转和缩放功能
- Android使用PhotoView实现图片双击放大单击退出效果
- Android开发使用Handler实现图片轮播功能示例
- Android 图片滚动,加入自动播放功能,使用自定义属性实现,霸气十足!
- Android实现图片的缩放翻转功能
- android photoview 图片放大缩放功能 ImageView
- PhotoView的使用--Android开发之点击图片放大的功能
- 使用Android ViewPager与PhotoView实现图片滑动查看
- Android图片滚动,加入自动播放功能,使用自定义属性实现,霸气十足!
- Android图片滚动,加入自动播放功能,使用自定义属性实现,霸气十足!
- Android图片滚动,加入自动播放功能,使用自定义属性实现,霸气十足!
- Android单点触控实现图片平移、缩放、旋转功能