当前位置: 编程技术>移动开发
本页文章导读:
▪adapter中的getview步骤使用说明 adapter中的getview方法使用说明
public View getView(int position, View convertView, ViewGroup parent)
适配器中的convertView刚开始是null,待画到哪一行的时候才初始化。也就是一行一行画出来的。
具体的初.........
▪ 随便地方显示对话框 任意地方显示对话框
AlertDialog.Builder builder = new AlertDialog.Builder(this);
LayoutInflater inf = getLayoutInflater();
View layout = inf.inflate(R.layout.main, null);
builder.setView(layout);
builder.setTitle("Add t.........
▪ Bit地图缩放的一个方法 Bitmap缩放的一个方法
public static Bitmap bitmapRoom(Bitmap srcBitmap,int newHeight,int newWidth) { int srcWidth = srcBitmap.getWidth(); int srcHeight = srcBitmap.getHeight(); float scaleWidth = .........
[1]adapter中的getview步骤使用说明
来源: 互联网 发布时间: 2014-02-18
adapter中的getview方法使用说明
public View getView(int position, View convertView, ViewGroup parent)
适配器中的convertView刚开始是null,待画到哪一行的时候才初始化。也就是一行一行画出来的。
具体的初始化方法大致如下:
if (convertView == null) {
convertView = mInflater.inflate(R.layout.my_list_item, null);
}
[2] 随便地方显示对话框
来源: 互联网 发布时间: 2014-02-18
任意地方显示对话框
AlertDialog.Builder builder = new AlertDialog.Builder(this); LayoutInflater inf = getLayoutInflater(); View layout = inf.inflate(R.layout.main, null); builder.setView(layout); builder.setTitle("Add to Home screen"); AlertDialog dialog = builder.create(); WindowManager.LayoutParams WMLP = dialog.getWindow().getAttributes(); int dialogOriginalHeight = WMLP.height; WMLP.height += 750; Log.i("XnY", "x="+WMLP.x+", y="+WMLP.y); WMLP.x = -10; //x position WMLP.y = -10; //y position Log.i("XnY", "x="+WMLP.x+", y="+WMLP.y); dialog.getWindow().setAttributes(WMLP); Log.i("POSITION", "POS::HEIGHT:"+WMLP.height); dialog.show();
[3] Bit地图缩放的一个方法
来源: 互联网 发布时间: 2014-02-18
Bitmap缩放的一个方法
public static Bitmap bitmapRoom(Bitmap srcBitmap,int newHeight,int newWidth)
{
int srcWidth = srcBitmap.getWidth();
int srcHeight = srcBitmap.getHeight();
float scaleWidth = ((float) newWidth) / srcWidth;
float scaleHeight = ((float) newHeight) / srcHeight;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap resizedBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcWidth,
srcHeight, matrix, true);
if(resizedBitmap != null)
{
return resizedBitmap;
}
else
{
return srcBitmap;
}
}
public static Bitmap bitmapRoom(Bitmap srcBitmap,int newHeight,int newWidth)
{
int srcWidth = srcBitmap.getWidth();
int srcHeight = srcBitmap.getHeight();
float scaleWidth = ((float) newWidth) / srcWidth;
float scaleHeight = ((float) newHeight) / srcHeight;
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
Bitmap resizedBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcWidth,
srcHeight, matrix, true);
if(resizedBitmap != null)
{
return resizedBitmap;
}
else
{
return srcBitmap;
}
}
最新技术文章: