You have made a small mistake buddy, you are assigning a wrong LayoutParam
to the view2
.
Replace,
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) rR2MessageBubble.getLayoutParams();
with
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(100,100); //or whatever width, height as per your need.
Hope you understand your mistake.