1

I have a a layout part of another layout that I make visible as follows:

AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);  
animation.setDuration(4000);  
myLayout.setAnimation(animation);  
myLayout.setVisibility(View.VISIBLE);  

In my example with the animation the linear layout appears (the myLayout) and the text inside the myLayout (which has TextViews) fades in.
Is there a way to make both the myLayout and the children TextViews fade in?

Update:
The problem is that when I set the animation on the parent layout, it is the children that appear slowly according to the animation.
So I have:

<LinearLayout

android:id="@+id/parent”

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_below="@id/someElement”

android:layout_marginTop=“5dp"

android:visibility="gone"
 >
 
 

<TextView

android:id="@+id/child”

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:textSize=“20sp”

android:textColor="@color/red”

android:gravity="center_vertical"

android:visibility="gone"
 

/> 
 </LinearLayout>

and the parent pops down fast and the children text appears slowly.
What I would like is the parent to smoothly pop down and the child to appear also slowly

Jim
  • 18,826
  • 34
  • 135
  • 254
  • Can you link an animation with this page animation? – oorosco Jul 24 '15 at 18:51
  • @oorosco:It is something that I have noticed and thought it was very smooth transition. But can't remember where. I thought it might be well known approach but could not find it google because don't know how it is called – Jim Jul 24 '15 at 18:55
  • I'm going to need a concrete example or at least a better explanation to help you out with 1 – oorosco Jul 24 '15 at 18:59
  • @oorosco:Ah...I have seen in on IPhone :-( ---> http://stackoverflow.com/questions/10756158/anyone-know-how-to-implements-the-effect-like-unfoldwhich-is-a-app-in-iphone – Jim Jul 24 '15 at 19:00
  • @oorosco:Can it be done without extra libraries? – Jim Jul 24 '15 at 19:01
  • eh... this is a bit complicated, I have no concrete knowledge as to how to implement this... perhaps using some 3d library, map the canvas onto the face of a 3d object? This is definitely more complicated then you'd think. Some more thoughts are going to be pushed to my answer down below – oorosco Jul 24 '15 at 19:03

1 Answers1

0

My answers

1) Not sure 100% but if you don't want to do this using a complicated path, probably off some equation you yourself would create to do something like this: Android -- Is it possible to warp a TextView? ^ Excerpt:

@Override onDraw(Canvas canvas){
    Path mPath = new Path();
    mPath.addCircle(x, y, 200, Path.Direction.CW);
    canvas.drawTextOnPath(textToDraw, mPath, textX, textY, paint);
}

Or this..

Step 1: converting a canvas into bitmap image in android step 2: Android: how to warp images?

So basically make a bitmap from a canvas of your view, skew that image 2) If i understand correctly, you want to fade in the parent, then fade in the children... soo...

private void doAnimation(){

    mLinearLayout.animate().alpha(1).setDuration(500);

    View child;
    for(int i=0; i< mLinearLayout.getChildCount(); i++){
        child = mLinearLayout.getChildAt(i);
        child.animate().setStartDelay(250)
                .alpha(1)
                .setDuration(750);
    }

}

Does this help?

Community
  • 1
  • 1
oorosco
  • 246
  • 3
  • 14
  • I did `myLayout.animate().alpha(1.0f).setDuration(500); textView.animate().setStartDelay(250).alpha(1.0f).setDuration(1000); textView.setVisibility(View.VISIBLE);` but nothing shows up now. Before I had the problem that the parent showed up first faster but now nothing is visible – Jim Jul 24 '15 at 19:18
  • can you post your sourecode in your question up top? I'm having trouble putting what you're doing into my head :P – oorosco Jul 24 '15 at 19:36
  • @Jim anyways let me know when you get a chance to post it – oorosco Jul 24 '15 at 22:18