Android OnClickListener监听接口用法范例.rar

时间:2022-07-30 13:12:32
【文件属性】:
文件名称:Android OnClickListener监听接口用法范例.rar
文件大小:36KB
文件格式:RAR
更新时间:2022-07-30 13:12:32
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()
--------bin()
--------res()
--------assets()
--------default.properties(449B)
--------gen()
--------src()
--------.project(846B)
--------.classpath(280B)
--------AndroidManifest.xml(675B)

网友评论