Android partial refresh, replacement in addition to fragment can also be used in

More control interface layout, in a activity control, click a substitution effect, it can be achieved using fragment but control too much, all written in fragment is not well controlled, jump or replace switching too much easy to error, view ID cannot find the and so on the question, what a good way to do? Thank you

Started by Norman at November 29, 2016 - 1:54 PM

Without fragment, the direct use of ViewGroup to dynamically add subviews can too.

Posted by Ingram at December 06, 2016 - 2:08 PM

This easy to use? Partial refresh can be achieved and replace it?

Posted by Norman at December 07, 2016 - 2:13 PM

LinearLayout layout = new LinearLayout(this);
layout.addView(childView); //Add view

layout.removeAllViews(); //Remove view

This is the same reason, can do.

Posted by Ingram at December 19, 2016 - 3:13 PM

Thank you, I have a try

Posted by Norman at December 25, 2016 - 3:44 PM

In fact, a Activity control many is not the major problem, the key is your code architecture design structure, you can be one of the main XML layout by splitting the relationship between certain into N sub XML layout, from the main XML layout to reference, and each sub XML layout is encapsulated into a specific class exposure, only several public interface on the line, so the code architecture, all the functions of a Activity is divided into N sub class + some auxiliary, such code profiles, convenient maintenance, can greatly save the development and debugging time.
Don't know that you have to understand.

Posted by Ignace at January 01, 2017 - 5:06 PM

Say it in detail, thank you, before the web program that architecture design is very clear, now replaced android app is not used, puzzle design comparison, what better way to do?

Posted by Norman at January 04, 2017 - 4:15 PM