Implementation method of creating clickable button in Android Development

This article describes the implementation method of creating clickable buttons for Android. Share with you for your reference, as follows:

I feel it necessary to learn about mobile phone development, whether for future work needs or current company projects.

Of course, the beginning of anything new must be accompanied by the first HelloWorld, and Android learning is no exception. Since it has just begun, I won't describe it too much.

For the IDE: ADT developed by Android, it's a little confused at the first glance. However, after reading the introduction of various directory structures on the Internet, we slowly understand that for this example, we need to pay special attention to two places, one is the SRC directory and the other is the layout directory under the res directory. The SRC directory places the code behind source code, while the layout directory places the XML foreground configuration file.

Since the function we want to achieve is to click the button, and then "Hello world!" will be displayed in EditText. Let's first open the layout file, drag and drop a button, and then drag and drop an EditText. The final XML file structure is as follows:

Then, in the background code file, we need to introduce two namespaces:

All codes are as follows:

Then click the run button and click the button in the virtual machine interface. The results are as follows:

That's all for this section. We'll continue to explore later.

More readers interested in Android related content can view the special topics of this site: summary of Android debugging skills and solutions to common problems, introduction and advanced tutorial of Android development, summary of Android multimedia operation skills (audio, video, recording, etc.), summary of usage of Android basic components, summary of Android view skills Android layout skills summary and Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>