0

This is my slide in anim

It can slide in MyActivity and stop at 50%

But, when the animation is finish, the activity will become 100% of screen, how can I keep it 50%?

Update 1:

startActivity(new Intent(this, MyActivity.class));
overridePendingTransition(R.anim.in,R.anim.out);

in.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

    <translate
        android:duration="500"
        android:fromXDelta="0%p"
        android:fromYDelta="100%p"
        android:toXDelta="0%p"
        android:toYDelta="50%p"
        />
</set>

out.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">

    <translate
        android:duration="500"
        android:fromXDelta="0%p"
        android:toXDelta="0%p"
        />
</set>
CL So
  • 3,647
  • 10
  • 51
  • 95

1 Answers1

1

What you need is Navigation Drawer and not activity stuck in the middle of the screen.

To position drawer on different side change android:layout_gravity property. android:layout_gravity="start" is for left to right. `android:layout_gravity="end" is for right to left.

Edit

It seems you need SlidingUpPanel. Take a look. From Docs:

You can set an anchor point in the middle of the screen using setAnchorPoint to allow an intermediate expanded state for the panel (similar to Google Maps).

arsena
  • 1,935
  • 19
  • 36
  • I just use Navigation Drawer as example, but that is not what I want, because it cannot slide from bottom, and I also need the second activity has transparent background, user can see first activity when second activity over it, so I implement by self. – CL So Mar 10 '16 at 02:36
  • no, you are wrong. then you need a different component for that. check updated answer – arsena Mar 10 '16 at 06:38