首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

给图标右下角添加小图标

2012-09-29 
给图标右上角添加小图标RelativeLayout.LayoutParams lp(RelativeLayout.LayoutParams) new LayoutParams

给图标右上角添加小图标

RelativeLayout.LayoutParams lp=(RelativeLayout.LayoutParams) new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.topMargin=-5;
lp.leftMargin=10;
lp.width=36;
lp.height=36;
RelativeLayout srcimg= (RelativeLayout) findViewById(R.id.relativeLayout1);//里面包含了一个图片

自适应显示
ImageView delimg=null;
delimg.setBackgroundResource(R.drawable.close);
// srcimg.addview(delimg,lp);
srcimg.addView(delimg, lp);

?

?

<RelativeLayout android:layout_width="wrap_content"
android:id="@+id/relativeLayout1" android:layout_height="wrap_content">
<ImageView android:layout_width="wrap_content"
android:id="@+id/imageView1" android:layout_height="wrap_content"
android:src="@drawable/icon"></ImageView>
</RelativeLayout>

热点排行