摘要: 在public class MainActivity extends Activity 后添加implements Button.OnClickListener比如:public class MainActivity extends Activity implements Button.OnClickListener{然后再里面添加 监听事件public void onClick(View arg0) {// TODO Auto-generated method stub}} 阅读全文
posted @ 2013-12-24 16:51 爱编程hao123 阅读(993) 评论(0) 推荐(0) 编辑
摘要: public class Ex_Ctrl_6 extends Activity implements Button.OnClickListener {/** Called when the activity is first created. */private TextView answer_TextView;private RadioButton boy_RadioButton, girl_RadioButton;private RadioGroup radioGroup;private Button answer_Button, clean_Button;private String[] 阅读全文
posted @ 2013-12-24 15:07 爱编程hao123 阅读(174) 评论(0) 推荐(0) 编辑
摘要: answer_TextView=(TextView)findViewById(R.id.TextView_Ask_And_Show);radioGroup=(RadioGroup)findViewById(R.id.RadioGroup);boy_RadioButton=(RadioButton)findViewById(R.id.RadioButton_Boy);girl_RadioButton=(RadioButton)findViewById(R.id.RadioButton_Gril);/*给单RadioGroup添加状态改变监听器*/radioGroup.setOnCheckedCh 阅读全文
posted @ 2013-12-24 14:21 爱编程hao123 阅读(606) 评论(0) 推荐(0) 编辑
摘要: CheckBox cb=new CheckBox(this); //声明一个checkboxcb.setHint("这是内容字体谈些"); //设置checkbox标题 字体比较淡cb.setHintTextColor(Color.YELLOW); //设置标题的Hint颜色cb.setText("这是内容字体黑些");//设置checkbox标题 字体比较深cb.setTextColor(Color.RED); //设置checkbox 颜色cb.setChecked(true); //设置checkbox是否是选中状态 cb.setEnabled(f 阅读全文
posted @ 2013-12-24 14:16 爱编程hao123 阅读(3379) 评论(0) 推荐(0) 编辑
摘要: AlertDialog.Builder 引用 android.app.AlertDialog.Builder AlertDialog.Builder ab=new AlertDialog.Builder(this);ab.setTitle("这是一个标题");ab.setMessage("这是提示内容"); ab.setIcon(R.drawable.right); //设置提示框图标 ab.setPositiveButton(R.string.about_dialog_ok, null); //给提示框添加ok按钮ab.show(); 阅读全文
posted @ 2013-12-24 14:03 爱编程hao123 阅读(114) 评论(0) 推荐(0) 编辑
摘要: ImageButton ib=new ImageButton(this); //声明一个imagebuttonib.setImageResource(R.drawable.a2); //设置imagebutton的图片Toast showImageToast=new Toast(this); //声明一个toastshowImageToast.setView(ib); //设置toast上显示的控件showImageToast.setDuration(Toast.LENGTH_LONG); //设置toast显示时间长短showImageToast.show(); //显示出来 阅读全文
posted @ 2013-12-24 13:56 爱编程hao123 阅读(154) 评论(0) 推荐(0) 编辑
摘要: CharSequence string2=getString(R.string.yourWish); 阅读全文
posted @ 2013-12-24 13:39 爱编程hao123 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Toast.makeText(MainActivity.this,"提示",Toast.LENGTH_LONG).show(); 三个参数,一本身.this二 提示内容 三 参数 Toast.LENGTH_LONG 长时间 Toast.LENGTH_SHORT 短时间 阅读全文
posted @ 2013-12-24 13:36 爱编程hao123 阅读(244) 评论(0) 推荐(0) 编辑
摘要: 在 drawable 文件夹中添加一个 advancedbutton.xml 设置设置 ImageButton 的 android:background 属性值 阅读全文
posted @ 2013-12-24 10:37 爱编程hao123 阅读(264) 评论(0) 推荐(0) 编辑