为了让SrollView中嵌套ExpandableListView,我们就得改ListView的高度,所以写一个类继承于ExpandableListview:

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ExpandableListView;


/**
 * Created by liang on 2016/8/21.
 */
public class NestedExpandaleListView extends ExpandableListView {
    public NestedExpandaleListView(Context context,AttributeSet attrs){
        super(context,attrs);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,

                MeasureSpec.AT_MOST);

        //将重新计算的高度传递回去
        super.onMeasure(widthMeasureSpec, expandSpec);
    }
}

这样大概就可以了,以后用到的ExpandableListView就改为NestedExpandaleListView(包括xml文件,activity中用到的地方)就可以了。

参考资料:http://blog.csdn.net/swust_chenpeng/article/details/17413955

相关文章:

  • 2022-02-11
  • 2021-12-22
  • 2022-12-23
  • 2021-12-31
  • 2021-12-05
  • 2021-06-27
  • 2022-12-23
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2021-09-08
  • 2021-12-05
  • 2021-12-05
  • 2022-12-23
相关资源
相似解决方案