On Wed, Mar 2, 2016 at 7:37 AM, joby <[email protected]> wrote:

> I am new to Android development.
>

Welcome.


> When I am trying to create a new activity, it always ends in 3 files.
> 1)  ****.java
> 2) activity_****.xml
> 3) content_****.xml
>
> I just wonder why it is creating two layout xml files?.
>

Because that's how the Android Studio developers chose to implement the new
activity wizard.


> By this post, what I am trying to find is...
>
> Is that the supposed way it should be created with two xml files for every
> new activity?,
> or just one activity_***.xml for the main and then separate
> content_***.xml for each additional activities?.
>

That's apparently the suggestion from the tool. What they're doing is
separating what amounts to boilerplate of the new CoordinatorLayout and
AppBarLayout with the actual layout content that is specific to your app.

An advantage to this is that the "shell" of the activity is consistent
across device screen sizes (same toolbar and FAB, for example) while the
main content can vary if you provide a different layout file for a
different screen size.

This is just one way of doing things and you are free to include your main
content directly in the main layout file or not if it makes sense for your
app.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/CANCScgg-nSjo2WgJ51uJj%2BM7g4Quhajt817r9hD20-c0VTLmPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to