Android One Activity Transition Different Views -


i wondering if can advise best way following: i'm creating application i'm asking user question , user either answers question or proceeds next question fade in , fade out animation using animator instead of anim. of now, have 1 activity , in activity load layout have created in xml , remove view , load new view.

i'm not sure if best way present multiple views in 1 activity , prevent need use multiple activities. reason why i'm doing because have several objects i'm storing data based on category of question (whether math, science, social studies, etc).

here picture if helps visualize: enter image description here


if there better way this, please let me know. issue i'm having activity java class growing in code because have handle there despite having classes of objects defined in other java files. thank you.

i think can build layout relativelayout(see structure) set layout1 android:visibility="visible" , layout2 android:visibility="invisible" @ first in .xml

    layout1 = findviewbyid(r.id.layout1);     layout1.setvisibility(view.visible);     layout2 = findviewbyid(r.id.layout2);     layout2.setvisibility(view.gone);      button buttonnext = (button)findviewbyid(r.id.buttonnext);     buttonnext.setonclicklistener(new button.onclicklistener(){         @override         public void onclick(view v) {             layout1.setvisibility(view.gone);             layout2.setvisibility(view.visible);                     viewtransanimation();         }      }); 

and set animation in viewtransanimation(), example:

private void viewtransanimation() {     layout2.setscalex(0.1f);     layout2.setpivotx(layout2.getx() + layout2.getleft() );      layout2.animate()             .scalex(1)             .setduration(500)             .setinterpolator(new accelerateinterpolator())             .start(); } 

then change layout2 after click it. (use flag make animation work once requirement.)

you can replace 2 view 2 relativelayout , in same way.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -