Canvas.scale()在Android上。重画全屏 [英] Canvas.scale() on Android. Redraw full screen
问题描述
因此,我使用Android开发人员的示例实现缩放我的活动。
So I'm using the example on Android Developers to implement pinch to zoom on my Activity.
Im缩放一个自定义视图,它有一个ScrollView )里面。
Im Scaling A Custom View which has a ScrollView(and other things) inside it.
当缩放时,只有实际显示的屏幕被调整大小 - 但我想缩小的东西显示更多的内容,因为他们有更多的空间在缩小时执行此操作。
我想让他们使用所有的全屏空间。
When im scaling, only the actual displayed Screen gets resized - but i want the scaled down things to show more of their content, because they have more space to do so when scaled down. I want them to use all the full screen space.
我的自定义视图ondraw方法看起来像这样:
My Custom Views ondraw method just looks like this:
public void draw(Canvas canvas) {
canvas.scale(mScaleFactor, mScaleFactor);
super.draw(canvas);
}
这是现在的样子
>
如果有什么不清楚,只要留下评论。任何帮助赞赏
编辑:我使我的自定义查看另一个背景颜色,现在我看到我的视图仍然是全屏只是没有孩子。
If anything is unclear, just leave a comment. Any Help is appreciated edit: i made my custom View another Background color and now i see that my View is still full screen just not the childs.
推荐答案
尝试强制使用 LayoutParams
缩放视图的大小。
Try forcing the size of the view that is being scaled with a LayoutParams
.
此主题提供了有关如何做到这一点。
This thread has more detail on how to do this.
这篇关于Canvas.scale()在Android上。重画全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!