Welcome 微信登录

首页 / 操作系统 / Linux / Android EditText 自动滚动条并显示最新内容

xml:<EditText
 Android:layout_width="fill_parent"
 android:layout_height="260px"
 android:id="@+id/chats_view"
 android:textColor="#000000"
 android:padding="5px"
 android:scrollbars="vertical"<!--垂直滚动条-->
 android:singleLine="false"<!--多行-->
 android:maxLines="14"<!--最多显示14行-->
 android:focusable="false"
 android:clickable="true"
 android:background="#ff87CEEB"
/>要在java代码中设置滚动的方法:et.setMovementMethod(ScrollingMovementMethod.getInstance());
下面是设置显示最新的内容:et.setSelection(chatsView.getText().length(), chatsView.getText().length());