第一例:HelloWorld
2015-10-09 17:07
375 查看
package demo.my.com.myapidemo.app; import android.app.Activity; import android.os.Bundle; import demo.my.com.myapidemo.R; public class HelloWorld extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
第一份android代码,离不开helloworld
xml代码
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <TextView android:text="@string/hello_world" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout>
资源文件strings
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="hello_world">Hello world</string> </resources>
相关文章推荐
- String源码解读之Resource接口
- fragment replace时的状态保存
- 求解算法的时间复杂度
- iOS开发---百度地图配置流程,2.6.0 版本 支持64位
- 【转+修改】什么是Mbps、Kbps、bps、kb、mb及其换算和区别
- MongoEngine 中文文档 系列教程 User Guide( 二)
- stvd watch 实时变量查看
- C#操作数据库中存取图片文件的方法
- MyBatis入门06 动态sql语句
- 《汇编语言(王爽)》第二章——寄存器(CPU工作原理)【总结】
- 【C语言】输出字符串
- springMVC原理
- nginx http 411 length required问题
- AsyncTask 使用和缺陷
- secilog 1.15 发布 增加了搜索保存数据库采集web日志报表等。
- MongoEngine 中文文档 系列教程 User Guide( 一)
- cocos2d-js 入门之碰撞
- 我是如何自学Android,资料分享(2015 版)
- 工厂模式及SDK源码中的运用
- 设A和B是两个单链表,其表中元素递增有序,使用一算法将A和B归并成一个案元素递减有序的单链表C(该程序中的功能包含了上几个博客中的部分功能)