Umano Android SlidingUpPanel - animation -
i using following project: https://github.com/umano/androidslidinguppanel
it works nicely far, have 1 issue: want hide slidable panel until press button, panel should faded in, animation; panel shown when button pressed, without animation, , don't know how implement said animation.
any ideas welcome!
i know it's been 4 months since asked, decided post answer anyways (so else can maybe benefit it).
fading in slideable panel relatively easy. need start alphaanimation on layout represents slideable panel. need disable panel shadow adding
sothree:shadowheight="0dp"
to major layout in xml.
the more interesting thing when want expand slideable panel bottom of screen (if panel anchored @ bottom). in case, can use following code:
import android.view.animation.animation; import android.view.animation.transformation; import com.sothree.slidinguppanel.slidinguppanellayout; public class slidinguppanelresizeanimation extends animation { private slidinguppanellayout mlayout; private float mto; private float mfrom = 0; public slidinguppanelresizeanimation(slidinguppanellayout layout, float to, int duration) { mlayout = layout; mto = to; setduration(duration); } @override protected void applytransformation(float interpolatedtime, transformation t) { float dimension = (mto - mfrom) * interpolatedtime + mfrom; mlayout.setpanelheight((int) dimension); mlayout.requestlayout(); } }
and start animation by:
slidinguppanellayout slidinguppanellayout = (slidinguppanellayout) findviewbyid(r.id.id_of_your_major_layout); int slideablepanelheight = 100; int animationduration = 800; slidinguppanelresizeanimation animation = new slidinguppanelresizeanimation(slidinguppanellayout, slideablepanelheight, animationduration); mslidinglayout.startanimation(animation);
Comments
Post a Comment