ScrollView和HorizontalScrollView常用属性,及禁止滑动
来源:互联网 发布:学c和java哪个好找 编辑:程序博客网 时间:2024/06/08 09:29
常用属性:详见注释
activity_main_28
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ScrollView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:fadingEdge="none" android:overScrollMode="never" android:scrollbarThumbVertical="@drawable/bar_style_v" > <!--ScrollView滚动条不显示 android:scrollbars="none"--> <!--ScrollView滚动条恒显示:android:fadeScrollbars="false"--> <!--设置垂直滚动条的drawable(如颜色):android:scrollbarThumbVertical,如果ScrollView中使用android:scrollbarThumbHorizontal,没有效果。反之亦然--> <!--设置滚动条的大小:android:scrollbarSize="20dp" ScrollView中,代表宽度--> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView style="@style/TV" android:text="111" /> <TextView style="@style/TV" android:text="222" /> <TextView style="@style/TV" android:text="333" /> <TextView style="@style/TV" android:text="444" /> <TextView style="@style/TV" android:text="555" /> <TextView style="@style/TV" android:text="666" /> <TextView style="@style/TV" android:text="777" /> <TextView style="@style/TV" android:text="888" /> <TextView style="@style/TV" android:text="999" /> <TextView style="@style/TV" android:text="11111" /> <TextView style="@style/TV" android:text="22222" /> <TextView style="@style/TV" android:text="33333" /> <TextView style="@style/TV" android:text="44444" /> <TextView style="@style/TV" android:text="55555" /> <TextView style="@style/TV" android:text="66666" /> <TextView style="@style/TV" android:text="77777" /> <TextView style="@style/TV" android:text="88888" /> <TextView style="@style/TV" android:text="99999" /> </LinearLayout> </ScrollView> <View android:layout_width="match_parent" android:layout_height="10dp" android:layout_marginBottom="5dp" android:layout_marginTop="5dp" android:background="#0000ff"/> <HorizontalScrollView android:layout_width="match_parent" android:layout_height="wrap_content" android:fadingEdge="none" android:overScrollMode="never" android:scrollbarThumbHorizontal="@drawable/bar_style_h" > <!--滚动条不显示 android:scrollbars="none"--> <!--滚动条恒显示:android:fadeScrollbars="false"--> <!--设置水平滚动条的drawable(如颜色):android:scrollbarThumbHorizontal--> <!--设置滚动条的大小:android:scrollbarSize="20dp" HorizontalScrollView中,代表高度--> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView style="@style/TV" android:text="111" /> <TextView style="@style/TV" android:text="222" /> <TextView style="@style/TV" android:text="333" /> <TextView style="@style/TV" android:text="444" /> <TextView style="@style/TV" android:text="555" /> <TextView style="@style/TV" android:text="666" /> <TextView style="@style/TV" android:text="777" /> <TextView style="@style/TV" android:text="888" /> <TextView style="@style/TV" android:text="999" /> <TextView style="@style/TV" android:text="11111" /> <TextView style="@style/TV" android:text="22222" /> <TextView style="@style/TV" android:text="33333" /> <TextView style="@style/TV" android:text="44444" /> <TextView style="@style/TV" android:text="55555" /> <TextView style="@style/TV" android:text="66666" /> <TextView style="@style/TV" android:text="77777" /> <TextView style="@style/TV" android:text="88888" /> <TextView style="@style/TV" android:text="99999" /> </LinearLayout> </HorizontalScrollView></LinearLayout>
bar_style_v和bar_style_h内容一样:
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#ff0000"/></shape>
只是单纯展示,主activity不必做任何操作
/** * ScrollView * HorizontalScrollView */public class MainActivity_28_ScrollView_HorizontalScrollView extends BaseActivity { @Override void initview() { setContentView(R.layout.activity_main_28); }}
禁止滑动:
scroll_view = (ScrollView) findViewById(R.id.scroll_view); scroll_view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { Log.e("chen", "ScrollView-onTouch"); //不能滑动 return true; //可以滑动 //return false; } });
horizontal_scroll_view.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View arg0, MotionEvent arg1) { Log.e("chen", "HorizontalScrollView-onTouch"); //不能滑动 return true; //可以滑动 //return false; } });
1 0
- ScrollView和HorizontalScrollView常用属性,及禁止滑动
- HorizontalScrollView及ScrollView解决滑动冲突
- ScrollView和HorizontalScrollView控件
- ScrollView+ListView禁止滑动
- AndroidGUI22:ScrollView/HorizontalScrollView常用技巧
- Android:ScrollView/HorizontalScrollView常用技巧
- 自定义HorizontalScrollView(横向滑动的ScrollView)
- scrollview常用属性和代理
- ScrollView和HorizontalScrollView的用法
- 滚动条:ScrollView和HorizontalScrollView
- ScrollView和HorizontalScrollView的使用
- Android开发——垂直水平滑动条scrollView和HorizontalScrollView的嵌套使用
- ScrollView常用属性及代理方法
- ScrollView/HorizontalScrollView常用技巧,附源码
- ScrollView/HorizontalScrollView常用技巧,附源码
- ScrollView中嵌套RecycleView出现的不显示,显示不全及滑动卡顿及ScrollView禁止滚动到中间
- Scrollview嵌套HorizontalScrollView导致横向滑动卡顿现象解决
- ScrollView嵌入HorizontalScrollView后滑动卡顿问题
- android.os包中一些类的使用
- emWin 2天速成实例教程005_控件聚焦和用户消息的使用方法
- 12款多媒体能力SDK与开发平台盘点
- Android深入浅出之Audio 第一部分 AudioTrack分析
- 虚拟机,开发板,笔记本相互连接
- ScrollView和HorizontalScrollView常用属性,及禁止滑动
- JNI在Android开发中的应用之--用AudioRecord录音,用AudioTrack播放声音.
- Android用surface直接显示yuv数据(二)
- Android 调用系统播放器,调用系统Camera
- centos 安装工具出现提示错误:Couldn't resolve host 'mirrorlist.centos.org'
- FullCalendar结合java springMVC
- Maven 如何修改本地仓库与中央仓库
- C++中使用stringstream简化类型转换
- [CE5入门系列1]如何正确安装和初步使用