I have a problem with my LinearLayout/View arrangement. I would like to have a space between my LinearLayout and my TextView (Like WhatsApp has). I tried to set the margins with LayoutParams but it didn't work out. Here my code:
public void sendMessage(View v) {
String actualMessage = textMessage.getText().toString();
TextView message = new TextView(this);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams)message.getLayoutParams();
message.setText(actualMessage);
message.setGravity(Gravity.RIGHT);
message.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
message.setBackgroundColor(getResources().getColor(R.color.orange));
params.setMargins(0, 0, 0, 0);
message.setLayoutParams(params);
linearLayout.addView(message);
}