文档介绍:Android 开发我的新浪微博客户端-大图浏览以及保存篇(7)
在阅读微博的功能篇中,如果微博包含了图片就会在微博正文下面显示该张图片,
但是这个图片只是张缩略图,这样就需要提供一个能放大缩小查看这张图片的功
能,当点击正文中的缩略图的时候显示一个简单的图片浏览器功能,提供图片的
放大、缩小、拖拽操作方便用户查看图片,同时也提供保存图片到手机的功能。
本功能的 UI 比较简单就不单独分篇讲了,具体的实现效果如上图。
新建 作为图片浏览 Activity,在 res/layout 下新建 的 L
ayout 作为图片浏览的布局文件, 布局代码很简单了就不详细解释了直接贴代
码:
<?xml version="" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas./apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="41px"
android:background="***@drawable/imagebar_bg">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2">
<Button
android:id="@+id/returnBtn"
android:layout_width="63px"
android:layout_height="29px"
android:layout_centerInParent="true"
android:text="返回"
android:textColor="#ffffff"
android:background="***@drawable/btn1_bg">
</Button>
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="浏览图片"
android:textColor="#ffffff">
</TextView>
</R