Code example for GradientDrawable

Methods: setColor, setShape, setStroke

0
		// View view1 = new View(context); 
		// view1.setLayoutParams(new 
		// TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 
		// LayoutParams.WRAP_CONTENT, 1)); 
		// container.addView(view1); 
		GradientDrawable drawable = new GradientDrawable();
		drawable.setShape(GradientDrawable.RECTANGLE);
		drawable.setStroke(1, Color.WHITE);
		drawable.setColor(Color.BLACK);
 
		Button button1 = new Button(context);
		button1.setText(text1);
		button1.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
		button1.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1));
		button1.setId(ID1);
		// button1.setBackgroundDrawable(drawable); 
		container.addView(button1);
 
		// View view2 = new View(context); 
		// view2.setLayoutParams(new 
		// TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,