使用什么activity_main或content_main? [英] What to use activity_main or content_main?

查看:132
本文介绍了使用什么activity_main或content_main?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是编程新手,我开始学习Java并使用eclipse已有一段时间,并且了解非常基础的知识. 最近,我开始使用android studio,除了很短的2.2.2版本(现在是最新的2.2.3)以外,我没有使用过任何其他版本. 我正在看旧教程,它们在activity_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.在最新版本中,我应该在activity_main还是content_main中工作?

1.In the newest version , should I work in the activity_main or in the content_main ?

  1. 在activity_main中,拖动n放下功能不起作用,我无法将任何东西从调色板移动到屏幕上所需的位置(它直接在屏幕的左上方).但是在content_main中,我只能移动一次,第二次,该对象将自己置于屏幕的左上方.我该如何解决?有什么问题?

我也想问一下,是否可以给我一些新的很棒的pdf或教程来学习.谢谢.

Also I want to ask , if you can give me some new great pdf or tutorials to learn . Thanks .

推荐答案

您应在项目的content_main XML文件中添加代码. Content_main实际上是包含MainActivity的大部分UI的文件,导航/工具栏除外.如果一开始您不舒服,则不要使用空白活动来创建项目,而应使用如图所示的空活动

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

这只会给您一个Activity_main XML文件供您使用.随着时间的流逝,您最终还将了解空白活动的用法.

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.

这篇关于使用什么activity_main或content_main?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆