我不想让我的滚动视图乱动,只想正常滚动。我发现这个类覆盖了ScrollView,但是由于我是安卓系统的新手,我不知道如何使用它。有什么想法吗?
进口android.content.Context;进口android.util.AttributeSet;进口android.widget.ScrollView; 公共类ScrollViewNoFling扩展ScrollView { /** * @param上下文* @param defStyle */ public ScrollViewNoFling(上下文){超级(上下文);// TODO自动生成的构造函数存根}公共ScrollViewNoFling( context,AttributeSet attrs) {超级( context,attrs);// TODO自动生成的构造函数存根} public ScrollViewNoFling(Context context,AttributeSet attrs,int defStyle) {超级(上下文,AttributeSet,defStyle);// TODO自动生成的构造函数存根} @Override (int velocityY) { /*Scroll视图将不再处理滚动速度。* super.fling(velocityY);*/ } }
发布于 2014-03-26 19:06:59
假设这个自定义类工作,而且您的包是com.example.app,您可以在layout.xml文件中使用sutom视图类,如下所示
<com.example.app.ScrollViewNoFling
android:layout_width="wrap_content"
android:layout_height="wrap_content"
...
/>但是您可以开始在IDE中键入包的前几个字母,它可能会出现。
此外,您还可以在IDE中的视图浏览器中找到这个自定义视图(可能在列表的底部)
希望这能有所帮助。
https://stackoverflow.com/questions/22670438
复制相似问题