android_demo01
/layout/activity_main.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:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" /> <TextView
android:id="@+id/mytext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/mybtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/> </RelativeLayout>
com.example.demo01textviewbutton.MainActivity
package com.example.demo01textviewbutton; import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView; //当在/layout/activity_main.xml中加控件后,R会自动生成相应的资源文件ID
public class MainActivity extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//编写相应业务逻辑
TextView textView = (TextView) super.findViewById(R.id.mytext);
textView.setText("buy big house");
Button mybutton=(Button)super.findViewById(R.id.mybtn);
mybutton.setText("clink me ,xixihehehaha");
} @Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
} }
R.java中生成以下:
public static final class id {
public static final int action_settings=0x7f080002;
public static final int mybtn=0x7f080001;
public static final int mytext=0x7f080000;
}
android_demo01的更多相关文章
随机推荐
- Delphi XE5 与其他版本共存
来源于http://www.board4allcz.eu 作者是gateway 如果你想使用Delphi诸如XE4.XE3.XE2.XE之类的版本跟Delphi XE5共存的话,在cglm.ini中简 ...
- eclipse dbviewer,eclipse java8
进入/home/xxx(用户名)/.local/share/applications,看是否有eclipse和深度音乐desktop配置文件,为eclipse.desktop配置图标, 那现在终端输入 ...
- 物联网操作系统HelloX V1.80测试版发布
经过HelloX开发团队近半年的努力,在HelloXV1.79版本基础上,增加许多功能特性,并对V1.79版本的一些特性进行了进一步优化之后,正式形成HelloX V1.80测试版本.经相对充分的测试 ...
- 详解 Qt 线程间共享数据(用信号槽方式)
使用共享内存.即使用一个两个线程都能够共享的变量(如全局变量),这样两个线程都能够访问和修改该变量,从而达到共享数据的目的. Qt 线程间共享数据是本文介绍的内容,多的不说,先来啃内容.Qt线程间共享 ...
- ArcGIS API for Silverlight 调用GP服务绘制等值面
原文:ArcGIS API for Silverlight 调用GP服务绘制等值面 GP服务模型如下图: 示例效果图片如下:
- CALayer的使用
http://blog.csdn.net/maylorchao/article/details/42652161 http://www.jianshu.com/p/8b0d694d1c69城觅
- CodeTimer
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using S ...
- git 入门 2
进入d盘,新建project文件, 右键,git bash here cd project 初始化 $ git init 克隆项目 $ git clone http://192.168.1.188:3 ...
- Qt4过渡至Qt5
技术在不断进步,新知识也理应不断学习!Qt5的发布带给我无尽的好奇心,然而,受项目影响,一直使用VS2008 + Qt4.8也未曾及时更新.这几天,果断装上VS2010 + Qt5.1,开始研究.Qt ...
- C# GridControl 行背景颜色
使用C# DevExpress_gridControl 行号行样式显示行背景颜色,必须取消自动变换行色属性 取消Focus变色,属性为OptionSelection--EnableAppearance ...