【发布时间】:2015-01-16 04:20:19
【问题描述】:
我正在使用 USB 连接设备来运行我的应用程序。在这个练习应用程序中,我使用了一个 Android 徽标图像来实现缩放功能。当我尝试更改 Activity 中的图像尺寸时,加载导入 USB 设备的应用程序时,它不会显示更改。徽标只是缩放以适应。但我希望它以我在设计视图中看到的方式显示图像:http://i.imgur.com/hcaOHjW.png
我从这个源分叉代码来实现缩放:http://www.c-sharpcorner.com/UploadFile/88b6e5/multi-touch-panning-pinch-zoom-image-view-in-android-using/ 它没有双击放大和缩小功能,所以让我知道我可以添加什么来实现它
这是我的活动的代码:
<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" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.example.test.firstapp.Login"
android:id="@+id/activity_activity2"
android:focusable="false"
android:nestedScrollingEnabled="false">
<ImageView
android:layout_width="180dp"
android:layout_height="220dp"
android:id="@+id/botImg"
android:src="@drawable/bot"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"/>
【问题讨论】:
标签: android imageview zooming multi-touch image-size