[二] EditText and Button

//Ctrl+D 删除
//RGB颜色对照 "#000000"->black "#00FF00"->green
android:inputType="number" //限制输入的是数字
android:hint="I'm EditText" //显示提示信息
//在drawable-mdpi中导入png格式的图片,图片名称为bai
android:drawableLeft="@drawable/bai" //引用图片

//在drawable-mdpi中创建xml文件shape.xml,代码
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <solid android:color="#00FF00"/>
    <corners android:radius="7dip"/> //设置矩形4个角的弧度
</shape>
View Code

 Button

//对于Button 设置事件
btn1=(Button)findViewById(R.id.button1);
btn1.setOnClickListener(new OnClickListener() {        
    @Override
    public void onClick(View v) {
        Toast.makeText(MainActivity.this, "Hello rubbish!!", Toast.LENGTH_LONG).show();
                
    }
});
View Code
posted @ 2013-05-22 18:57  zhang1107  阅读(101)  评论(0编辑  收藏  举报