在XML文件中设置
<EditText
android:id="@+id/record"android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:editable="false"
android:gravity="top"
android:lines="7"
android:singleLine="false" />,
然后,在Java代码中在EditText设置完值之后,设置属性:
String newMsg = et_Message.getText().toString();
String history = sp.getString("historyMessage", null);
Log.i(TAG + "history msg:", history);
et_Record.setText(history + newMsg);
if (msgHisList.size() <= 0) {
showToast("no group chat history record!");
} else {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < msgHisList.size(); i++) {
sb.append(msgHisList.get(i) + "\n");
}
et_Record.setText(sb.toString());
et_Record.setSelection(et_Record.length());
}