简体   繁体   English

Android:使自定义视图的尺寸大于屏幕的尺寸

[英]Android: make the size of a custom view bigger than the size of screen

enter image description here I have a custom view and the user can draw rectangles(I used canvas). 在这里输入图像描述,我有一个自定义视图,用户可以绘制矩形(我使用了画布)。 I would make the size of custom view bigger than the size of the screen. 我要使自定义视图的大小大于屏幕的大小。 So, the user can draw not only in the size of screen. 因此,用户不仅可以绘制屏幕尺寸。 I tried ScrollView and NestedScrollView but they are not helpful to solve my problem. 我尝试了ScrollView和NestedScrollView,但它们对解决我的问题没有帮助。

As far as I could understand from this question is you want to make a canvas where someone can draw some pictures. 据我从这个问题可以理解的是,您想制作一个可以在其中绘制一些图片的画布。 So you need a bigger canvas to that user can drag the positions to left-right, up and down. 因此,您需要一个更大的画布,以便该用户可以左右左右拖动位置。 If I understood correctly, then I would say, you might think of a different work-around instead of looking for a view bigger than the screen size. 如果我理解正确,那么我会说,您可能会想到其他解决方法,而不是寻找大于屏幕尺寸的视图。

You can think of an simple ImageView which will be auto zoomed-in and if the user clicks twice it'll zoom-out. 您可以想到一个简单的ImageView ,它将自动放大,如果用户单击两次,它将放大。 The user can drag the positions of the ImageView whenever he wants. 用户可以随时拖动ImageView的位置。

Here's an SO answer about how you can implement the zoom in and out in an ImageView . 这是一个关于如何在ImageView实现放大和缩小的解答 Hope this will help to solve your problem. 希望这将有助于解决您的问题。

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

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