2013-11-05 23 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因爲它的使用範圍。