完美解决android:ScrollView嵌套ListView的问题 .
2012-09-04 11:26
531 查看
package com.cyol.android.wbxy.mylistview;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
public class MySingListView extends ListView
{
public MySingListView(Context context)
{
super(context);
// TODO Auto-generated constructor stub
}
public MySingListView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public MySingListView(Context context, AttributeSet attrs)
{
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
// TODO Auto-generated method stub
int expandSpec = MeasureSpec.makeMeasureSpec(
Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
<com.test.MySingListView
android:id="@+id/sing_remark_listView"
android:layout_width="fill_parent"
android:layout_height="40.0dip"
android:layout_below="@id/sing_remark_progressBar"
android:scrollbars="none" >
</com.test.MySingListView>
经测试~~这种办法可以完美解决ScrollView嵌套ListView的问题 .
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ListAdapter;
import android.widget.ListView;
public class MySingListView extends ListView
{
public MySingListView(Context context)
{
super(context);
// TODO Auto-generated constructor stub
}
public MySingListView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public MySingListView(Context context, AttributeSet attrs)
{
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
// TODO Auto-generated method stub
int expandSpec = MeasureSpec.makeMeasureSpec(
Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, expandSpec);
}
}
<com.test.MySingListView
android:id="@+id/sing_remark_listView"
android:layout_width="fill_parent"
android:layout_height="40.0dip"
android:layout_below="@id/sing_remark_progressBar"
android:scrollbars="none" >
</com.test.MySingListView>
经测试~~这种办法可以完美解决ScrollView嵌套ListView的问题 .
相关文章推荐
- Android 快速解决Listview与ScrollView嵌套的问题,与分析解决问题原理
- Android中解决scrollview中嵌套listview的listview只显示一行的问题
- Android ScrollView 下嵌套 ListView 或 GridView出现问题解决办法
- Android开发--解决ScrollView中嵌套ListView问题
- Android圆角ListView并完美解决和ScrollView共存问题
- Android开发自定义ListView解决在NestedScrollView里不能用listview的问题(ScrollView嵌套ListView的问题)
- Android ScrollView里嵌套Listview,造成Listview的Item显示1行问题的最正确的解决方法
- Android ScrollView中嵌套ListView滚动效果冲突问题解决
- 解决android的ListView嵌套在ScrollView中不能被滚动的问题
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- android scrollview嵌套listview,高度异常问题解决
- 【Android - 问题解决】之ScrollView嵌套ListView时总是自动滑动到ListView顶部的问题
- Android ScrollView嵌套Viewpager嵌套ListView切换时到顶部或位置改变问题解决
- 完美解决Android中,ScrollView嵌套ListView的冲突。
- Android 解决ScrollView下嵌套ListView进页面不在顶部的问题
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- 完美解决Android里面scrollview嵌套及listview嵌套viewpager的滑动冲突问题的简单方法
- 【Android基础学习】动态设置 listView的高度,解决scrollView中嵌套listview时显示不全的问题
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题
- 【Android界面实现】解决ScrollView中嵌套Listview,Listview中嵌套Listview显示不完整和滑动冲突的问题