Android下面两级嵌套ListView会出现滑动失效,解决方案,把两级Listview全换成NoScrollListView,代码如下:

 

  1. public class NoScrollListView extends ListView {  
  2.     public NoScrollListView(Context context) {  
  3.         super(context);  
  4.     }  
  5.   
  6.     public NoScrollListView(Context context, AttributeSet attrs) {  
  7.         super(context, attrs);  
  8.     }  
  9.   
  10.     public NoScrollListView(Context context, AttributeSet attrs, int defStyle) {  
  11.         super(context, attrs, defStyle);  
  12.     }  
  13.   
  14.     @Override  
  15.     public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {  
  16.         int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,  
  17.                 MeasureSpec.AT_MOST);  
  18.         super.onMeasure(widthMeasureSpec, expandSpec);  
  19.     }  
  20.   
  21. }  


       然后在父Listview外面放个ScrollView实现滑动就Ok了

相关文章:

  • 2021-09-15
  • 2022-12-23
  • 2022-01-09
  • 2021-06-10
  • 2021-11-17
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
相关资源
相似解决方案