android - How to slide in a Hidden View from top -




i implement view slides top when button/image/label on actionbar clicked. work default drawerlayout, except sliding left/right sides, slides top-down in case.

how can go this? android have default class or action handles this?

what i've managed mentioning solution, androidswipelayout. however, not looking for.

thank in advance.

if have button call following function click on button this.

clickme.setonclicklistener(new view.onclicklistener() {     @override     public void onclick(view v) {         yourlinerlayout.setvisibility(view.visible);         setlayoutanim_slidedown(view);     } }); 

and here's setlayoutanim_slidedown function slide down layout want slide top down.

public void setlayoutanim_slidedown(viewgroup panel) {      animationset set = new animationset(true);      animation animation = new translateanimation(             animation.relative_to_self, 0.0f, animation.relative_to_self,             0.0f, animation.relative_to_self, -1.0f,             animation.relative_to_self, 0.0f);      // set duration here animation in millis.      animation.setduration(2000);     animation.setanimationlistener(new animation.animationlistener() {          @override         public void onanimationstart(animation animation) {         }          @override         public void onanimationrepeat(animation animation) {         }          @override         public void onanimationend(animation animation) {         }     });     set.addanimation(animation);      layoutanimationcontroller controller = new layoutanimationcontroller(             set, 0.25f);     panel.setlayoutanimation(controller); } 

for example, layout this.

<android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/main_content"     android:layout_width="match_parent"     android:layout_height="match_parent">      <linearlayout         android:id="@+id/slider"         android:layout_width="match_parent"         android:layout_height="200dp"         android:background="@color/coloraccent"         android:orientation="horizontal"         android:visibility="gone">          <textview             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:layout_gravity="center"             android:gravity="center"             android:text="masud noob"             android:textcolor="@android:color/white"             android:textstyle="bold" />     </linearlayout>      <button         android:id="@+id/button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="click me" />  </android.support.design.widget.coordinatorlayout> 

the items inside linearlayout named slider animate here.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -