在相对布局ImageView的能见度问题 [英] ImageView Visibility Issue in Relative Layout

查看:116
本文介绍了在相对布局ImageView的能见度问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过各种各样code,这让我觉得我的工作应该的,但由于某些原因,它没有。我有一个垂直向下动画另一个图像的ImageView的,我想移动的ImageView消失,一旦动画完成,但事实并非如此。在'scanbar'的ImageView是一个问题。它被设置为在XML无形,并且由上可见按钮preSS。我需要当动画完成后它去了。

I've seen all sorts of code that makes me think that mine should work, but for some reason it does not. I've got an ImageView that animates vertically down another image and I want the mobile imageview to disappear once the animation is complete but it does not. The 'scanbar' imageview is the one in question. it is set as invisible in the XML and is made visible on a button press. I need it to go away when the animation is finished.

public class scan extends Activity {

EditText Quote;
private static final Random rgenerator = new Random();
ImageView scanbar;
public void scanLine()  {
    // Displays the scanline animation over the wireframe image


    ImageView wireframe;
    scanbar = (ImageView)findViewById(R.id.scanbar);
    wireframe = (ImageView) findViewById(R.id.wireframe);
    scanbar.setVisibility(View.VISIBLE);
    // Super ultra-secret code

}
Animation.AnimationListener scanListener = new Animation.AnimationListener() {

    @Override
    public void onAnimationStart(Animation animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationRepeat(Animation animation) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationEnd(Animation animation) {
        // TODO Auto-generated method stub
        scanbar.setVisibility(View.INVISIBLE);
        setResults();
    }
};

该setResults();电话正常工作,所以我知道正在执行code部分。任何人都知道我在做什么错了?

The setResults(); call works properly, so I know that section of code is being executed. Anyone know what I'm doing wrong?

推荐答案

会给这个古老问题的答案,以防有人绊倒在它和我一样。

Will give this old question an answer just in case someone stumbles upon it like me.

点击这里,查看stickupkid的回答是:<一href=\"http://stackoverflow.com/questions/7424371/android-setvisbility-to-gone-not-working-in-relativelayout\">Android, setVisbility以走后没在RelativeLayout的工作。呼叫 clearAnimation()上什么都查看调用之前是做动画 View.INVISIBLE

Check out stickupkid's answer here: Android, setVisbility to gone not working in RelativeLayout. Call clearAnimation() on what ever view is doing the animation before calling View.INVISIBLE

这篇关于在相对布局ImageView的能见度问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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