What is the difference between enabling a layout or enabling a fragment in Android?

I am looking for my Eclipse IDE for Android, and I think that in most cases I can perform the same actions, including a layout or including a fragment, because both can be controlled through the Java class. I am not very good at snippets after reading a lot of posts ... I think I can create a responsive layout without them, including another layout in my main layout. So ... Do you think there are any differences between including a layout or including a fragment in Android? Can you explain to me if the option is better than the other?

+8
source share
3 answers

From Android docs :

A snippet represents the behavior or part of the user interface in an Activity. You can combine several fragments in one action to create a multi-panel user interface and reuse a fragment in several actions. You can think of the fragment as a modular section of an activity that has its own life cycle, receives its own input events, and which you can add or remove during the execution of the action (something like a “supporting action” that you can reuse in various activities).

, Fragments . , , , , .. Fragment. . , Fragments .

+6

. , .

- , , "" . .

0

-, Android- . , , .

, , , Java, . 5 , Java , , .

, , , , .

0

Source: https://habr.com/ru/post/1539490/


All Articles