源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

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

  • 时间:2021-03-09 23:13 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Android 中ScrollView与ListView冲突问题的解决办法
[b]Android 中ScrollView与ListView冲突问题的解决办法[/b] 自定义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即可使用 如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部