Android 如何在imageview上添加更多图像
我被卡住了,没有任何解决办法 问题是,我有一个gridview,我想在上面添加更多的图像。 我在下面的代码中使用了新的适配器类。 但我想添加两个按钮,它重叠在一起Android 如何在imageview上添加更多图像,android,Android,我被卡住了,没有任何解决办法 问题是,我有一个gridview,我想在上面添加更多的图像。 我在下面的代码中使用了新的适配器类。 但我想添加两个按钮,它重叠在一起 I use LinearLayout for this @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub
I use LinearLayout for this
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
ImageView imageView;
if (convertView == null) {
imageView = new ImageView(context);
imageView.setLayoutParams(new GridView.LayoutParams(85, 85));
imageView.getLayoutParams().width = 200;
imageView.getLayoutParams().height = 200;
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
}
else
{
imageView = (ImageView) convertView;
}
imageView.setImageResource(imageId[position]);
return imageView;
}
基本上,ImageView只能设置一次图像,因此如果您需要显示五月的图像,您可以使用多个ImageView,也可以使用抽屉布局CMIW如果使用抽屉布局,我无法为每个图像调整大小:ex:img 1=50x 50 img 2=100 x 100。。等init imageView之后,我看到了两个相同的图像。mys代码:Resources r=getResources();可拉伸[]层=新的可拉伸[2];层[0]=r.getDrawable(r.drawable.img1);层[1]=r.getDrawable(r.drawable.i,mg2);LayerDrawable LayerDrawable=新的LayerDrawable(层);TestImageSetImageDrawable(layerDrawable);n避免使用
ImageView
将LinearLayout
与继承的ImageView