简体   繁体   English

Android:单击按钮放大ImageView的特定部分

[英]Android: Zoom on a particular part of an ImageView on button click

I have an ImageView with a bunch of Buttons underneath the image. 我有一个ImageView在图像下方带有一堆按钮。 I want to be able to zoom on a particular part of that ImageView depending on which of the buttons I press! 我希望能够放大ImageView的特定部分,具体取决于我按下的按钮! I'm new to Android Development so any help on this will be very much appreciated. 我是Android开发的新手,因此非常感谢您提供任何帮助。

Cheers! 干杯!

ImageView is a complete view, either you operate on it completely or do nothing on it. ImageView是一个完整的视图,您可以完全对其进行操作,也可以不对其进行任何操作。 In my opinion what you can do is slice the images into 'n^2' parts and display them as a grid of nXn and when the user presses a button to increase the grid size then slice it into (n+1)^2 and then a grid of (n+1)*(n+1) and so on. 在我看来,您可以将图像切成“ n ^ 2”个部分并将其显示为nXn的网格,并且当用户按下按钮以增大网格大小时,将其切成(n + 1)^ 2和然后是(n + 1)*(n + 1)的网格,依此类推。

EDIT: 编辑:

Lets have a root RelativeLayout and then we will have multiple imageviews in that something like below 让我们有一个根RelativeLayout,然后我们将有多个图像视图,如下所示

<RelativeLayout
   .....
   .....>
   <ImageView android:id="@+id/kitchen"
     .....
     .....
   />
   <ImageView android:id="@+id/bedroom"
     android:layout_toRightOf="@id/kitchen"
     .....
     .....
   />
   .....
   .....
   </RelativeLayout>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM