Android 开发:改进 EditText 滚动? [英] Android Development: Improve EditText Scrolling?

查看:23
本文介绍了Android 开发:改进 EditText 滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么办法可以增加我的 EditText 滚动?我想让它像浏览网页一样滚动,流畅且快速.这可能吗?

Is there any way I can increase my EditText's scrolling? I want to make it scroll like it does on the web browse, smooth and fast. Is this possible?

谢谢,亚历克斯.

推荐答案

Webview 使用平滑滚动.滚动视图也有这个属性.

Webview uses Smooth scrolling. A scroll view also have this property.

  • 在滚动视图中添加文本视图.
  • 为滚动视图创建 ID 并在代码中创建引用.
  • 将 EditText 放置在此滚动视图中(使 editText 包装内容).

使用以下方法启用平滑滚动,

Enable Smooth Scrolling using the below method,

public void setSmoothScrollingEnabled(boolean smoothScrollingEnabled)

通过指定滚动边界来控制平滑滚动,使用以下方法...

Control the smooth scrolling by specifying bounds for the scroll, using the below method...

public final void smoothScrollBy (int dx, int dy)
//dx,dy.. offset (Relative Position)

public final void smoothScrollTo (int x, int y)
//scroll to x and y (actual position)

您也可以使用以下方法模仿过度滚动行为,

You can also imitate the overscroll behavior using the following Method,

public void setOverScrollMode (int mode)

您也可以使用以下方法添加 Fling Action,..

Also you can add Fling Action using the following method,..

public void fling (int velocityY)

这篇关于Android 开发:改进 EditText 滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆