首页 > 代码库 > Textview的左边图片设置

Textview的左边图片设置

tv_radaritem_name.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

isShow = !isShow;

if(isShow)

{

Drawable img = getResources().getDrawable(R.drawable.radar_imgpress);

img.setBounds(0, 0, img.getMinimumWidth(), img.getMinimumHeight());

tv_radaritem_name.setCompoundDrawables(null, null, img, null);

radar.setVisibility(View.VISIBLE);

liner_search.setVisibility(View.INVISIBLE);

isShow = true;

}else{

Drawable img = getResources().getDrawable(R.drawable.radar_imgnomal);

img.setBounds(0, 0, img.getMinimumWidth(), img.getMinimumHeight());

tv_radaritem_name.setCompoundDrawables(null, null, img, null);

radar.setVisibility(View.INVISIBLE);

liner_search.setVisibility(View.VISIBLE);

isShow = false;

}

}

});


本文出自 “android开发” 博客,谢绝转载!

Textview的左边图片设置