Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
325 views
in Technique[技术] by (71.8m points)

java - What to use activity_main or content_main?

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 ?

  1. 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 .

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You should add code in the content_main XML file of your project. Content_main is actually the file containing the most of the UI of your MainActivity,except your navigation/toolbar. If at the beginning you are uncomfortable then instead of creating project with Blank activity, use Empty Activity shown in Figure enter image description here

This will give you just only one activity_main XML file to work with. With time you will eventually understand the usage of Blank Activity as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...