1:设置选中图片的背景颜色class="Apple-converted-space">
this.gridviewToolbar = (GridView) super.findViewById(R.id.gridviewbar);
this.gridviewToolbar.setSelector(new ColorDrawable(Color.TRANSPARENT));
2:通过屏幕的长度,宽度来定义控件的长宽
this.width = super.getWindowManager().getDefaultDisplay().getWidth()
/ this.menu_img.length;
this.height = super.getWindowManager().getDefaultDisplay().getHeight() / 8;
3:退出的对话框
private void exitDialog() {
Dialog dialog = new AlertDialog.Builder(this)
.setMessage("您确定要退出本程序吗?")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
LoginActivity.this.finish() ;
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}).create();
dialog.show();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_BACK) {
this.exitDialog() ;
}
return false ;
}
4:取消标题,必须在设置布局文件之前取消掉
super.requestWindowFeature(Window.FEATURE_NO_TITLE);