I am new in programming , I started learning java and worked with eclipse some time and know the very basics . Recently I started working with android studio and I have not used any other version except the 2.2.2 for very short period , and now the newest 2.2.3 . I am watching old tutorials and they work in activity_main , so my questions are :
1.In the newest version , should I work in the activity_main or in the content_main ?
- In the activity_main the drag n drop function is not working , I can't move anything from palette to the screen to where i want (it goes directly in top left on the screen ). But in the content_main i can move once , and the second time the object puts itself in top left of the screen . How can i solve this and what is the problem ?
Also I want to ask , if you can give me some new great pdf or tutorials to learn . Thanks .
I would suggest to get familiar with the different Android layouts (
CoordinatorLayout
as in theactivity_main
,LinearLayout
and so on). They define how you can arrange items within the layout, so whether there are some constraints on placing items depends on the layout.There is no overall solution, whether someone should use
content_main
and thus, nest layouts or just put everything into one file like e.g.activity_main
.I personally use the nesting if I use a more complex layouts like an
Activity
with anavigation drawer
. But for an app with one activity without additional navigation I would put everything intoactivity_main
.For learning how to use the layouts one file might be easier instead of nesting.