1、listView去除点击时背景的黑色:android:cacheColorHint="#00000000"
2、RatingBar监听数目改变:level.setOnRatingBarChangeListener (new RatingBar.OnRatingBarChangeListener () {
public void onRatingChanged (RatingBar ratingBar, float rating, boolean fromUser) {
float r=level.getRating();
}
});
3、取消EditText的自动弹出键盘:在AndroidMenifest文件中的该Activity中添加 android:windowSoftInputMode="stateAlwaysHidden"
4、AlterDialog中添加checkBox:
final CharSequence[] items = {"1","2","3"};
AlertDialog.Builder builder = new AlertDialog.Builder(Xianchang.this);
builder.setTitle("选择要显示的图层");
builder.setMultiChoiceItems(items,new boolean[]{false,false,false},new DialogInterface.OnMultiChoiceClickListener() {
public void onClick(DialogInterface dialog,int whichButton, boolean isChecked) {
/* User clicked on a check box do some stuff */
}
});
AlertDialog alert = builder.create();
alert.show();
5、listView中的CheckBox获取选中的信息:
holder.cBox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
if(isChecked)
{
receivers.add((Person)data.get(arg0).get("person"));
}
else{
receivers.remove((Person)data.get(arg0).get("person"));
}
}});
6、在AlertDialog中显示图片:
ImageView i=new ImageView(Report1.this);
i.setImageBitmap(bm);
AlertDialog imageDialog = new AlertDialog.Builder(Report1.this).create();
imageDialog.setView(i);
imageDialog.show();
7、调用系统摄像头:
Intent i = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(i, Activity.DEFAULT_KEYS_DIALER);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == Activity.DEFAULT_KEYS_DIALER) {
if (resultCode == RESULT_OK) {
}
}
}