2013-11-05 36 views
1

我正在尝试设置与ColorDrawable界让backgroundDrawable到View,它只是不能正常工作,使用下面的代码:ColorDrawable不会在其边界画

ColorDrawable d = new ColorDrawable(getContext().getResources() 
     .getColor(R.color.red)); 
d.setBounds(0, 0, 20, 20); 

convertView.setBackgroundDrawable(d); 

结果是convertView背景得到填补这里有红色。

谢谢。

+0

你的要求究竟是什么? –

回答

0

好的,所以当使用Drawable作为背景ViewView是它的布局时,边界会改变。因此,有严格的界限,我需要延长Drawable并有私人Rect因为它的使用范围。