I have done some research on that issue , but I have not found anything similar just yet.
First I make a border of Linear Layout using ShapeDrawable then I have try to set background color on LinearLayout but color is not set then I have comment two line of ShapeDrawable then after I have set the background color of Linear Layout but problem occur in border color.
That's value I have got through JSON of background color and border color.
I want to set that value dynamically Background color and border color of Linear Layout through java code.
Please Guide me.
Thanks
LinearLayout linearToAdd = new LinearLayout(getActivity());
linearToAdd.setOrientation(VERTICAL);
float d = getActivity().getResources().getDisplayMetrics().density;
linearToAdd.setBackgroundColor(Color.parseColor((String)(mPod.getBackground())));
switch(parentType){
case LINEAR_LAYOUT:
LinearLayout.LayoutParams linearParams = new LinearLayout.LayoutParams((int)(mPod.getWidth()*d),(int)(mPod.getHeight()*d));
Log.d(TAG,"LinLay, W,H,T,L: "+mPod.getWidth()+", "+mPod.getHeight()+", "+mPod.getLeft()+", "+mPod.getTop());
linearParams.setMargins(mPod.getLeft(), mPod.getTop(), 0,0);
linearToAdd.setLayoutParams(linearParams);
ShapeDrawable rectShapeDrawable1 = new ShapeDrawable();
Paint paint1 = rectShapeDrawable1.getPaint();
// paint1.setColor(Color.rgb(0, 0, 0));
paint1.setStyle(Paint.Style.STROKE);
paint1.setStrokeWidth(3);
// linearToAdd.setBackgroundDrawable(rectShapeDrawable1);
break;
}