安卓代码中设置ImageView属性
ImageView :iv
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(10, 10, 10, 10); iv.setLayoutParams(lp);
设置图片
iv.setImageDrawable(getResources().getDrawable(R.drawable.sdate1));