Button
来源:互联网 发布:java泛型编程最全总结 编辑:程序博客网 时间:2024/04/28 19:13
MainActivity.java
package com.czk.testview;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;import android.widget.Toast;public class MainActivity extends Activity {private Button btn1=null;protected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);btn1=(Button)findViewById(R.id.btn1);btn1.setOnClickListener(new OnClickListener() {public void onClick(View v) {// TODO Auto-generated method stubToast.makeText(MainActivity.this, "你按到按钮了", Toast.LENGTH_LONG).show();;}});}}
activity_main.xml
<LinearLayout 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:orientation="vertical"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="24sp" android:text="@string/hello_world"/> <Button android:id="@+id/btn1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button"/></LinearLayout>
0 0
- button.
- button
- button
- button
- button
- button
- Button
- button
- Button
- Button
- button
- button
- Button
- Button
- Button
- Button
- button
- button
- Openfire Hazelcast集群详解
- django MVC、MTV
- nanosleep()函数使用
- JZOJ 3453. 连通块(connect)
- 分享一个完整程序的代码(消除类游戏)
- Button
- 浅谈Java设计模式(三)单例模式(Singleton)
- SET IDENTITY_INSERT 选项使用
- iframe 自适应高度
- 高通平台MSM8916LCM模块移植(一)-bootloader部分
- 吉林敦化黑石电站来我公司考察
- 【Codeforces 609E】【Stree】【最小生成树】
- 第一个linux编译
- 卷积神经网络