ScrollView嵌入ListView
来源:互联网 发布:连接网络打印机 编辑:程序博客网 时间:2024/05/21 12:41
public class MainActivity extends Activity{ @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); ArrayList<String> data = new ArrayList<String>(); for (int i=0;i<50;i++){ data.add("data"+i); } setContentView(R.layout.main_activity); ListView list = (ListView) findViewById(R.id.list); ArrayAdapter adapter = new ArrayAdapter(getApplication(),R.layout.support_simple_spinner_dropdown_item,data); list.setAdapter(adapter); //对手势进行监听 list.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()){ case (MotionEvent.ACTION_DOWN): v.getParent().requestDisallowInterceptTouchEvent(true);//监听action_down事件 break; case (MotionEvent.ACTION_CANCEL): v.getParent().requestDisallowInterceptTouchEvent(false); } return false; } }); }}
//布局
<?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"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffee90"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_gravity="center"> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="100dp" android:background="#ffc012"> </ListView> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> </LinearLayout> </ScrollView></LinearLayout>
0 0
- scrollview嵌入listview问题
- ScrollView嵌入ListView
- ListView嵌入ScrollView问题解决大全
- ScrollView 中嵌入ListView 控件 滑动ListView
- Android 使ListView能够嵌入ScrollView
- 如何在ScrollView中如何嵌入ListView
- 如何在ScrollView 中如何嵌入ListView
- android中ScrollView如何嵌入ListView
- 如何在ScrollView中如何嵌入ListView
- 关于ScrollView嵌入ListView,或ListView嵌入ListView,导致里层的ListView无法滑动解决方法。
- ScrollView中嵌入ListView,让ListView全显示出来
- ScrollView中嵌入ListView,让ListView全显示出来
- scrollview中嵌入listview动态计算listview的高度
- android中scrollview中嵌入listview 产生的滚动问题
- ScrollView中如何嵌入ListView只显示一条的解决办法
- MeasureSpecx学习(ScrollView中嵌入ListView,GridView冲突的解决)
- ListView嵌入ScrollView中出现的问题及解决方法
- 关于Android中ScrollView嵌入ListView重写OnMeasure后ListView在顶端的解决方法
- Http请求中Content-Type讲解
- php 添加 redis 扩展模块
- IOS TextField 属性设置大全
- linux awk命令详解
- 在java web项目中配置freemarker
- ScrollView嵌入ListView
- 《Java虚拟机原理图解》 1.2.3、Class文件中的常量池详解(下)
- iOS model类的快速生成
- 数组指针和指针数组的区别
- 河南工业大学2017校赛 C 魔法宝石【最短路变形】
- TensorFlow-抽取模型某一层特征
- AngularJS中的$http.post与jQuery.post的区别
- 使用@InitBind来解决字符串转日期类型 (9)
- python-pythonic