相关疑难解决方法(0)

ScrollView alawys滚动到底部

我在布局中定义了一个带有texteedit的scrollview:

 <ScrollView android:fillViewport="true"
     android:layout_marginBottom="50dip"
     android:id="@+id/start_scroller"
     android:layout_height="fill_parent"
     android:layout_width="fill_parent"
     android:fadingEdge="none">
 <TextView  
    android:id="@+id/text"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" >
 </TextView>
 </ScrollView>
Run Code Online (Sandbox Code Playgroud)

我使用以下方法向此ScrollView添加文本:

public void writeToLogView(String textMsg) {
   if (text.getText().equals("")) {
       text.append(textMsg);
   } else {
    text.append("\n" + textMsg);
    scroller.scrollBy(0, 1000000);
   }
}
Run Code Online (Sandbox Code Playgroud)

如您所见,我附加文本并尝试滚动到ScrollView的底部.不幸的是,这不能正常工作.它向下滚动,但并非总是如此,并不总是向下滚动.任何提示?

java android scrollview

14
推荐指数
2
解决办法
2万
查看次数

标签 统计

android ×1

java ×1

scrollview ×1