Canvas.scale()在Android上。重绘全屏幕 [英] Canvas.scale() on Android. Redraw full screen

查看:1220
本文介绍了Canvas.scale()在Android上。重绘全屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我使用Android开发者的例子来实现捏放大在我的活动。

So I'm using the example on Android Developers to implement pinch to zoom on my Activity.

林缩放自定义视图具有滚动型(和其他的东西),它里面。

Im Scaling A Custom View which has a ScrollView(and other things) inside it.

当IM缩放,只有实际显示的屏幕被调整 - 但我想按比例缩小的东西来显示更多的内容,因为他们有更多的空间缩小时这样做。
我希望他们能够使用所有的全屏幕空间。

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);
}

这是什么样子,现在

如果有什么不清楚,只是发表评论。任何帮助AP preciated
编辑:我做了我的自定义视图另一种背景颜色,现在我看到,我的看法是依然充满屏幕只是没有孩子的

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.

<一个href=\"http://stackoverflow.com/questions/17001707/view-not-showing-all-content-after-scaling-down/17010535#17010535\">This螺纹对如何做到这一点的详细信息。

This thread has more detail on how to do this.

这篇关于Canvas.scale()在Android上。重绘全屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆