I am working now, so I cannot verify this, but I believe that this should work:
LinearLayout linLay = (LinearLayout) findViewById(R.id.theLinearLayoutId); //set background to a color linLay.setBackgroundColor(Color.parseColor("#404040")); //set background to a drawable linLay.setBackgroundDrawable(drawableItem); //set background to a resource linLay.setBackgroundResource(R.id.backgroundResource);
kcoppock
source share