2011.10.14(2)——— android 仿照微信的图片展示功能 之 放大超过屏幕

1、
<ImageView    android:id="@+id/myImageView"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:scaleType="center"/>


我想是不是因为宽高设置的为fill_parent 所以造成了图片只能显示到屏幕大小呢

修改

android:layout_width="wrap_content"android:layout_height="wrap_content"


运行之后 还是不行 依然只能在屏幕内显示


2、突然想起来 前两天做了一个只显示图片中间位置的例子
http://lipeng88213.iteye.com/admin/blogs/1180817


这个还是设计到 android:scaleType
因为系统默认是用fitCenter显示的
也就是按比例拉伸图片,拉伸后图片的高度为View的高度,且显示在View的中间
按比例所以 原图是宽大于高 修改的图也将会是宽大于高的

所以我们可以改为center
<ImageView    android:id="@+id/myImageView"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:scaleType="center"/>


哈哈 果然可以 效果如下:




还有一个小功能 就是单击图片的话 隐藏下方的工具条

修改
<ImageView    android:id="@+id/myImageView"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    android:scaleType="center"/>


改成wrap_content

增加touch监听

@Overridepublic boolean onTouch(View v, MotionEvent event) {// TODO Auto-generated method stubLog.i(TAG, "onTouch...");if(isVisible){zoomControll.setVisibility(View.INVISIBLE);isVisible = false;}else{zoomControll.setVisibility(View.VISIBLE);isVisible = true;}return  super.onTouchEvent(event);    }


注册即可
mImageView.setOnTouchListener(this);



更多相关文章

  1. 快速进入Android世界
  2. android:layout_weight总有你不知道的用法.
  3. Android软键盘的显示与隐藏
  4. Android屏幕密度(Density)和分辨率的关系
  5. android selector
  6. android TextView属性大全
  7. Android屏幕适配攻略
  8. Android如何使布局中图(ImageButton)和文字(TextView)同时获得press
  9. Android(安卓)游戏开发的一些基础和经验

随机推荐

  1. Android(安卓)framework Watchdog的监控
  2. Android(安卓)UI开发专题
  3. Android(安卓)简介:Android(安卓)SDK 和开
  4. Android(安卓)基础 源码 工具
  5. Android中的人脸检测(静态和动态)
  6. android 屏幕方向切换 锁定方向
  7. Android进程与线程基本知识
  8. android 界面布局-各个布局的属性介绍
  9. Android文档阅读03—开发工具
  10. android 系统状态栏的隐藏和显示