简体   繁体   English

图像大于屏幕

[英]Image bigger than the screen

I think I have a simple question, but after a few hours I still can't manage it. 我想我有一个简单的问题,但几个小时后我仍然无法解决。

I have an image which fits into screen height, but it's wider than the available space. 我有一个适合屏幕高度的图像,但是比可用空间宽。
I would like to animate this image. 我想为这张图片制作动画。
It's something like this: 就像这样:

尝试

As of now, I made an animation by using the translate component in animation.xml file. 到目前为止,我通过使用animation.xml文件中的translation组件制作了动画。
But when I'm animating this ImageView - it's cut. 但是,当我为这个ImageView设置动画时-它被剪切了。
Everything which is bigger than the screen is deleted. 大于屏幕的所有内容都将被删除。

Is ImageView the right component to store images like this? ImageView是存储这样的图像的正确组件吗?
Or maybe should I use other View and setting the image as background? 还是应该使用其他“视图”并将图像设置为背景?

The animation will repeat forever including reverse - I managed it out already, but is Translation the best choice for that issue? 动画将永远重复,包括反转-我已经对其进行了管理,但是对于该问题,“翻译”是否是最佳选择?

I need to animate 2 images to make something like a parallax effect 我需要为2张图片制作动画,以产生像视差效果一样的效果

I think i found solution. 我想我找到了解决方案。 The case was: parrent of component had match_parent wich is full screen ( and nothing more ). 案例是:组件的match_parent处于全屏状态(仅此而已)。 ImageView was cliped to parent size. ImageView已裁剪为父尺寸。 I solved it by adding ScrollView as parent, and disabling scroll function by adding onTouchListener: 我通过将ScrollView添加为父级来解决它,并通过添加onTouchListener禁用了滚动功能:

    sView.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            return true;
        }
    });

This is for sure not nice method to solve it - but it worked. 当然,这不是解决问题的好方法-但却奏效了。

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

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