LinearLayout parent = (LinearLayout) findViewById(R.id.root);
int layoutId = (условие на правый) ? R.layout.custom : R.layout.main;
View view = getLayoutInflater.inflate(layoutId, parent, false);
view.findViewById(R.id.nick).setText(...);
view.findViewById(R.id.message).setText(...);
parent.addView(view);
View view = getLayoutInflater.inflate(R.layout.message, parent, false);
view.findViewById(R.id.message).setText(...);
parent.addView(view);