首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > Java > Android OnClickListener监听接口用法范例

Android OnClickListener监听接口用法范例

  • 资源大小:36.43 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:0次
  • 资源积分:1积分
  • 标      签: Android

资 源 简 介

Android OnClickListener监听接口用法范例,基础级的例子,   Button button = (Button) findViewById(R.id.Button01);//获取屏幕中的按钮控件对象   button.setOnClickListener(//为按钮对象添加OnClickListener接口实现    //OnClickListener为View的内部接口,其实现者负责监听鼠标点击事件   new View.OnClickListener(){   public void onClick(View v){   LinearLayout ll=(LinearLayout)findViewById(R.id.lla);//获取线性布局对象   String msg=LinearActivity.this.getResources().getString(R.string.button);   Button tempbutton=new Button(LinearActivity.this);//创建一个Button对象   tempbutton.setText(msg+(++count));//设置Button控件显示的内容   tempbutton.setWidth(80);//设置Button的宽度   ll.addView(tempbutton);//向线性布局中添加View   System.out.println("========= count"+count);

文 件 列 表

codesc.net
ClickListener
.project
ClickListener
ClickListener
.classpath
codesc.net
VIP VIP
  • 睥睨 7小时前 成为了本站会员

  • ? 8小时前 成为了本站会员

  • IATWAY 1天前 成为了本站会员

  • 大智若愚 1天前 成为了本站会员

  • Mason 1天前 成为了本站会员

  • 1天前 成为了本站会员

  • Half_Punch 2天前 成为了本站会员

  • liqing71718 2天前 成为了本站会员

  • 伟国 2天前 成为了本站会员

  • songy 2天前 成为了本站会员

0.224628s