android - LayoutTransition disappearing and changing not happening at same time -


i have custom "bottom action bar" here: https://youtu.be/tpi5jtcs2we, appears , disappears types of webpages (e.g. article/not article). set outermost linearlayout animatelayouttransition , made different layouttransition object, want bar disappear @ same time webview adjusts height. clear, bar (relativelayout) being set view.gone , webview should expand match parent (due layout_weight) since bar gone, it's not doing both @ same time. tried changing layouttransition.setduration() , .setstartdelay().

the articleactivity xml:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:orientation="vertical"     android:id="@+id/container_article"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="app.morningsignout.com.morningsignoff.articleactivity"     tools:ignore="mergerootframe"     android:background="@android:color/white"     android:animatelayoutchanges="true">     <app.com.morningsignout.morningsignout.customwebview         android:layout_width="match_parent"         android:layout_height="0dp"         android:id="@+id/webview_article"         android:layout_gravity="center"         android:layout_weight="9" />     <relativelayout         android:layout_width="match_parent"         android:layout_height="?android:attr/actionbarsize"         android:layout_weight="0" 

the configuration of layouttransition:

linearlayout container = (linearlayout) findviewbyid(r.id.container_article); layouttransition customtransition = new layouttransition(); customtransition.enabletransitiontype(layouttransition.changing); customtransition.disabletransitiontype(layouttransition.change_appearing); customtransition.disabletransitiontype(layouttransition.change_disappearing); customtransition.setanimator(layouttransition.appearing, showarticlebar); customtransition.setanimator(layouttransition.disappearing, hidearticlebar); customtransition.setstartdelay(layouttransition.appearing, 0); customtransition.setstartdelay(layouttransition.disappearing, 0); customtransition.setstartdelay(layouttransition.changing, 0); customtransition.setduration(layouttransition.appearing, showarticlebar.getduration()); customtransition.setduration(layouttransition.disappearing, hidearticlebar.getduration()); customtransition.setduration(layouttransition.appearing, showarticlebar.getduration());  container.setlayouttransition(customtransition); 

hide_action_bar.xml:

<?xml version="1.0" encoding="utf-8"?> <objectanimator xmlns:android="http://schemas.android.com/apk/res/android"     android:propertyname="translationy"     android:duration="300"     android:valuefrom="0"     android:valueto="?android:attr/actionbarsize"/> 

show_action_bar.xml:

<?xml version="1.0" encoding="utf-8"?> <objectanimator xmlns:android="http://schemas.android.com/apk/res/android"     android:propertyname="translationy"     android:duration="300"     android:valuefrom="?android:attr/actionbarsize"     android:valueto="0"/> 

i though layouttransition.changing animation make work, no. how webview's height change , removal of bar occur @ same time? despite setting durations , start delays line up, it's not working. think issue changing has happen after view.gone because of needing know height after view gone. either or not changing animation.

i figured out. turns out needed change_appearing , change_disappearing make smoother, not changing. it's not perfect, both animations happen @ same time. tried actual top actionbar's hide()/show() functions , think normal.

linearlayout container = (linearlayout) findviewbyid(r.id.container_article); layouttransition customtransition = new layouttransition(); // customtransition.enabletransitiontype(layouttransition.changing); // customtransition.disabletransitiontype(layouttransition.change_appearing); // customtransition.disabletransitiontype(layouttransition.change_disappearing); customtransition.setanimator(layouttransition.appearing, showarticlebar); customtransition.setanimator(layouttransition.disappearing, hidearticlebar); customtransition.setstartdelay(layouttransition.appearing, 0); customtransition.setstartdelay(layouttransition.disappearing, 0); customtransition.setstartdelay(layouttransition.change_appearing, 0); customtransition.setstartdelay(layouttransition.change_disappearing, 0); // customtransition.setstartdelay(layouttransition.changing, 0); customtransition.setduration(layouttransition.appearing, showarticlebar.getduration()); customtransition.setduration(layouttransition.disappearing, hidearticlebar.getduration()); customtransition.setduration(layouttransition.change_appearing, showarticlebar.getduration()); customtransition.setduration(layouttransition.change_disappearing, hidearticlebar.getduration()); // customtransition.setduration(layouttransition.appearing, showarticlebar.getduration());  container.setlayouttransition(customtransition); 

this creates issue webview persists scrolly position though on new webpages, wrong (should @ top of page on new pages). fixed containing webview in linearlayout.

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:orientation="vertical"     android:id="@+id/container_article"     android:layout_width="match_parent"     android:layout_height="match_parent"     tools:context="app.morningsignout.com.morningsignoff.articleactivity"     tools:ignore="mergerootframe"     android:background="@android:color/transparent"     android:animatelayoutchanges="true">      <linearlayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="9">          <app.com.morningsignout.morningsignout.customwebview             android:layout_width="match_parent"             android:layout_height="match_parent"             android:id="@+id/webview_article"             android:layout_gravity="center" />     </linearlayout>      <relativelayout         android:layout_width="match_parent"         android:layout_height="?android:attr/actionbarsize"         android:layout_weight="0"... 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -