简体   繁体   中英

Unexpected Animation Behavior

在此处输入图片说明

My situation:

  1. Target SDK: 2.2
  2. Target Animation Effect: Path menu. When you swipe to the right, the upper view is animated to the right, revealing the underneath menu view.

My XML structure:

<Parent Relative Layout>    //background color is white
    <Upper Linear Layout>
    <Bottom Linear Layout>  //background color is red
</Parent Relative Layout>

My 2 approaches to animate the upper linear layout:

  1. Official pre-honeycomb TranslateAnimation method, with FillAfter set to true.
  2. Un-offcial pre-honycomb ObjectAnimator.ofFloat method through nineoldandroids

What I expect with both these 2 approaches:

  1. Animation is triggered
  2. Upper linear layout is gradually animated to the right
  3. Underneath linear layout (red background) is gradually revealed

What I actually see with both these 2 approaches:

  1. Animation is triggered
  2. Upper linear layout is gradually animated to the right
  3. Parent relative layout (white background) is gradually revealed
  4. Underneath linear layout is no where to be seen

I've no idea what I am doing wrong here. Please help.

Problem solved. I need to dynamically create this Upper Linear Layout and add it to the Parent Relative Layout , instead of declaring it statically in the xml. When I do swipe animation again, the underneath bottom linear layout will appear.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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