Split screen animation android like that of Explore canada -
i trying implement screen animation of https://dribbble.com/shots/3268934-split-screen-navigation-concept or can view below same file. https://drive.google.com/open?id=0bwl9aaqktv_ycfpqzuztuxznduu.
i have done below thing doesnot perform in required manner.
i have used 3 imageviews in linear layout aligned horizontally in weight 1,1,2 respectively,then in activity
fun animate(v: imageview) { var initialwidth = v.getwidth() var initialheight = v.getheight() var alpha = objectanimator.offloat(v, "alpha", 0.0f); var scale = objectanimator.offloat(v, "scalex",v.x); var translatex = objectanimator.offloat(v, "translationx",(v.width).tofloat()); var animatorst=animatorset() animatorst.playtogether(alpha,scale,translatex) animatorst.setduration(3000) animatorst.addlistener(this) animatorst.start() } override fun onanimationend(p0: animator?) { if (isfirstview) { ivfirst.visibility = view.gone; isfirstview = false; issecondview = true; animate(ivsecond) } else if (issecondview) { issecondview = false; isthirdview = true; ivsecond.visibility = view.gone; animate(ivthird) } else { isthirdview = false; } } //activity oncreate oncreate(){ animate(ivfirst) isfirstview = true; } //layout file <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" > <imageview android:id="@+id/ivfirst" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:scaletype="fitxy" app:srccompat="@drawable/com_facebook_button_background"/> <imageview android:id="@+id/ivsecond" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:scaletype="fitxy" app:srccompat="@drawable/com_facebook_button_send_background"/> <imageview android:id="@+id/ivthird" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="2" android:scaletype="fitxy" app:srccompat="@color/coloraccent"/> </linearlayout>
Comments
Post a Comment