我想在Edittext中自动滚动到底部。
我在网上找不到任何关于它的内容。它只关于ListView。
有没有任何解决方案来使用Edittext?
谢谢
您可以使用EditText.ScrollTo
方法并计算所需的scrollY:
etMain = FindViewById<EditText>(Resource.Id.etMain);
...
//get the lineHeight
int lineHeight = etMain.LineHeight;
//get the line Count
int lineCount = etMain.LineCount+1;
//calculate the scrollY;
int scrollY = lineHeight * lineCount;
//scroll to the bottom
etMain.ScrollTo(0, scrollY);
我尝试使用ScrollTo,但它不起作用。
但是使用RequestFocus它有效:)
谢谢