如何在 Android Eclipse 中编写按钮?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8359184/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I Program a button in Android Eclipse?
提问by Whammo Kablammo
I have recently started programming android apps (put simply, i have next to no experience with android programming). I have some experience with basic HTML, but not much beyond that. I have also been searching the internet for weeks on how to program one little button. None of them have worked. There are several XML layouts in my res folder, and all of them have buttons. What I need to know is how I can program a button in one of my XML layouts so that when it is pressed it takes me to another XML layout. However, if you answer this, please put a step-by-step guide, and tell me where to put the code including the placement in the code. My real problem, is the fact that i put in the code that tutorials tell me to, and it tells me that there are errors.
我最近开始编写 android 应用程序(简单地说,我几乎没有 android 编程经验)。我对基本 HTML 有一些经验,但除此之外不多。我也在互联网上搜索了几个星期,了解如何对一个小按钮进行编程。他们都没有工作。我的 res 文件夹中有几个 XML 布局,它们都有按钮。我需要知道的是如何在我的一个 XML 布局中对按钮进行编程,以便在按下按钮时它会将我带到另一个 XML 布局。但是,如果您回答此问题,请提供分步指南,并告诉我将代码放在哪里,包括代码中的位置。我真正的问题是,我输入了教程告诉我的代码,它告诉我存在错误。
here are some of the websites i have tried:
以下是我尝试过的一些网站:
http://developer.android.com/resources/faq/commontasks.html#opennewscreen
http://developer.android.com/resources/faq/commontasks.html#opennewscreen
How to navigate from one screen to another screen
回答by vanevery
Here is a step by step guide: http://itp.nyu.edu/~sve204/mobilemedia_spring10/android101.pdf
这是一个分步指南:http: //itp.nyu.edu/~sve204/mobilemedia_spring10/android101.pdf
回答by njzk2
You can probably start here http://developer.android.com/resources/tutorials/notepad/index.html
你可以从这里开始 http://developer.android.com/resources/tutorials/notepad/index.html