在相对布局ImageView的能见度问题能见度、布局、问题、ImageView

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

我见过各种各样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的回答是: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

阅读全文

相关推荐

最新文章