软件编程
位置:首页>> 软件编程>> Android编程>> Android 中ScrollView与ListView冲突问题的解决办法

Android 中ScrollView与ListView冲突问题的解决办法

作者:三杯五岳  发布时间:2022-06-15 04:31:46 

标签:Android,ScrollView,ListView

Android 中ScrollView与ListView冲突问题的解决办法

自定义MyListView


public class MyListView extends ListView
{
 public MyListView(Context context)
 {
   super(context);
   // TODO Auto-generated constructor stub
 }

public MyListView(Context context, AttributeSet attrs)
 {
   super(context, attrs);
   // TODO Auto-generated constructor stub
 }

public MyListView(Context context, AttributeSet attrs, int defStyle)
 {
   super(context, attrs, defStyle);
   // TODO Auto-generated constructor stub
 }

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
 {
   int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
   super.onMeasure(widthMeasureSpec, expandSpec);
 }
}

在xml布局中直接用MyListView替换ListView即可使用

如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

来源:http://blog.csdn.net/u013164293/article/details/72521058

0
投稿

猜你喜欢

手机版 软件编程 asp之家 www.aspxhome.com