在Android Studio的模拟器中未调整图像大小
我正在使用USB连接设备运行我的应用程序。在这个实践应用程序中,我使用了一个Android徽标图像来实现缩放功能。当我尝试在“活动”中更改图像尺寸时,在加载导入usb设备的应用程序时,它不会显示更改。徽标只需缩放以适合。但我希望它以我在设计视图中看到的方式显示图像: 我从这个源代码派生代码来实现缩放: 它没有双击放大和缩小功能,所以让我知道我可以添加什么来实现它 以下是我的活动代码:在Android Studio的模拟器中未调整图像大小,android,imageview,zooming,multi-touch,image-size,Android,Imageview,Zooming,Multi Touch,Image Size,我正在使用USB连接设备运行我的应用程序。在这个实践应用程序中,我使用了一个Android徽标图像来实现缩放功能。当我尝试在“活动”中更改图像尺寸时,在加载导入usb设备的应用程序时,它不会显示更改。徽标只需缩放以适合。但我希望它以我在设计视图中看到的方式显示图像: 我从这个源代码派生代码来实现缩放: 它没有双击放大和缩小功能,所以让我知道我可以添加什么来实现它 以下是我的活动代码: <RelativeLayout xmlns:android="http://schemas.android
<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"/>
在java类中,尝试创建此视图,然后尝试更改高度和宽度参数。动态膨胀此视图并在java中分配参数。不要将xml用于此视图