Android小菜鸟记录每天所学---01

  昨天开始算真正从javaWeb方向转战到Android上!昨天搭建平台,一个 helloWorld正了我半天!其实到时不是什么问题!没弄明白,一个Android虚拟机启动后要等个二三分钟后才能真正运行程序的!我都是启动后没见程序出来就关了,然后有启动!反反复复几次,最后还从装了一次Eclipse和Android平台的搭建! 我汗···

    记录下:今天的劳动成果!

//   这个是建的Activity  刚一开始把Activity都弄错了!写成了Activtiy 了 呵呵!!!

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

/**
 * 创建Activtiy的要点
 * 1.一个activtiy就是一个类,并且这个类要继承Activtiy
 * 2.需要复写onCreate方法
 * 3.每一个activtiy都要在AndroidManifest.xml文件中进行配置
 * 4.为activtiy添加必要的控件
 * @author Administrator
 *
 */

public class Activtiy01 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
     TextView myTextView=   (TextView)findViewById(R.id.myTextView);
     Button myButton=(Button)findViewById(R.id.myButton);
     myTextView.setText("我的第一个TextView");
     myButton.setText("我的第一个Button"+"/n"+"test");
       
    }
}

 

//main 的 配置

 

<?xml version="1.0" encoding="utf-8"?>


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent">
 <TextView
 android:id="@+id/myTextView"
    android:layout_width="fill_parent"
 android:layout_height="wrap_content" />
 <Button
 android:id="@+id/myButton"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content">


 </Button>
</LinearLayout>

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值