码迷,mamicode.com
首页 > 其他好文 > 详细

ScrollView嵌套ListView全显

时间:2014-12-24 11:52:42      阅读:153      评论:0      收藏:0      [点我收藏+]

标签:android   文档   界面   android开发   listview   

ScrollView显示ListView内容,全部展开显示

重写ListView

public class MyListView extends ListView {

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

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

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

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

        super.onMeasure(widthMeasureSpec, expandSpec);
    }
}

把原来的ListView换成MyListView  最外层用ScrollView布局就可以实现了,剩下的你自己想怎么写都可以。。。。


ScrollView嵌套ListView全显

标签:android   文档   界面   android开发   listview   

原文地址:http://blog.csdn.net/menglele1314/article/details/42120579

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!