Android现学现用第一天

Android现学现用第一天,第1张

概述原文链接:http://www.cnblogs.com/NateSheng/archive/2011/09/01/2162528.html1.Mac系统下Eclipse还是挺好用的,苹果对于Android的支持不错。Mac下的Eclipse的菜单在最上面的苹果菜单栏里,不要乱翻了。使用起来和Windows下的Eclipse差不多。2.src,gen和re 原文链接:http://www.cnblogs.com/NateSheng/archive/2011/09/01/2162528.html

1.Mac 系统下Eclipse还是挺好用的,苹果对于AndroID的支持不错。Mac下的Eclipse的菜单在最上面的苹果菜单栏里,不要乱翻了。使用起来和windows下的Eclipse差不多。

2.src,gen和res是三个主要的部分。src是java源码部分,gen是自动生成的,res里是图片资源和页面控件,draw里面是图片,layout中的xml是控件信息,这里更改后保存,gen中直接就变了。value是一些变量的值。

3.layout xml中注册控件是这样的:

<button  

    androID:ID="@+ID/report_button"

    androID:layout_wIDth="fill_parent" 

    androID:layout_height="wrap_content" 

    androID:text="Report YAMI!"

    />

gen中的R类里是这样自动生成的:

 public static final class ID {

        public static final int report_button=0x7f050001;

        public static final int search_button=0x7f050000;

        public static final int textvIEw=0x7f050002;

    }

SRC中是这样引用的:

public voID onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentVIEw(R.layout.main);

        search_Now();

        report_Now();

    }

private button.OnClickListener button_report_Listener = new button.OnClickListener(){

    @OverrIDe

public voID onClick(VIEw v) {

//跳转页面

    setTitle("To indicate report!");

}

    };

private voID report_Now(){

    button button_report = (button)findVIEwByID(R.ID.report_button);

button_report.setonClickListener(button_report_Listener);

}

直接定义监听器,在方法中就把button控件定义好了,在把定义好的监听器放进去就行。

最后加一句,helloworld创建工程后直接就能显示出来了,不用找源代码了。甚至不需要以前还要system.out.println...白找了那么久

转载于:https://www.cnblogs.com/NateSheng/archive/2011/09/01/2162528.HTML

总结

以上是内存溢出为你收集整理的Android现学现用第一天全部内容,希望文章能够帮你解决Android现学现用第一天所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1112784.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-29
下一篇 2022-05-29

发表评论

登录后才能评论

评论列表(0条)

保存