Android的游戏开发 - 自动的ImageView在缩小屏幕的边缘 [英] Android Game development - Imageview automatically shrinks at screen edge
问题描述
我有一大堆的动态创建ImageViews重新在一场比赛中,这是工作的罚款presenting不同的对象。然而,如果任何图像到达屏幕的边缘,它收缩。看起来Android是试图创建一个平滑的过渡,但这不是想要的。
I have a bunch of dynamically created ImageViews representing different objects in a game, which is working fine. However if any Image reaches the edge of the screen, it shrinks. Looks like android is attempting to create a smooth transition, but this is not wanted.
我发现这里的同一个问题的另一个线程:<一href=\"http://stackoverflow.com/questions/9918634/animation-drawable-gets-automatically-shrinks-at-the-corners\">Animation绘制对象自动获得缩在角落?,但是他的解决方案并没有为我工作,只因为它一旦启动保证金碰到屏幕边缘萎缩提高的问题。
I found another thread with the same issue here: Animation Drawable gets automatically shrinks at the corners ?, however his solution does not work for me, it only enhances the issue as it starts shrinking once the margin hits the screen edge.
这是我的code:
final LayoutParams _updated_params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
_updated_params.setMargins((int)m_x, (int)m_y, 0, 0);
m_image.setLayoutParams(_updated_params);</code>
其中m_x / m_y是图像的绝对位置和m_image是一个ImageView的实例
Where m_x/m_y is the absolute position of the image and m_image is an ImageView instance.
有谁知道我怎么可以关闭这个自动调整大小?
Does anyone know how I can turn off this automatic resizing?
推荐答案
添加setScaleType
Add setScaleType
m_image.setScaleType(ScaleType.MATRIX);
这篇关于Android的游戏开发 - 自动的ImageView在缩小屏幕的边缘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!