自定义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即可使用


Android学习交流群:523487222

(如果您觉得有用,欢迎加入,一起学习进步)
点击链接加入群【Android学习群】



更多相关文章

  1. Android(安卓)Lamda 学习
  2. Android有用代码片段(一)(二)....
  3. cocos2d-x学习之旅(四):1.4 使用eclipse编译Android(安卓)C++
  4. Android(安卓)studio爬取网页
  5. Android学习记录使用Gallery实现炫丽的拖动效果
  6. (转)Android(安卓)Animation学习笔记
  7. Android学习之菜单
  8. android之Buffer类及子类学习
  9. 我的Android进阶之旅------>Android百度地图定位SDK功能学习

随机推荐

  1. Python笔记-几种取整方式
  2. python 中 字符串转换为数组,字典或表达式
  3. 详解Python中的from..import绝对导入语句
  4. python入门之常见列表、字典知识
  5. 如何使用pip安装Python MySQLdb模块?
  6. 检测Python程序的执行效率
  7. python自然语言处理——3.8 分割
  8. 转:图解 Python 深拷贝和浅拷贝
  9. Python3语法——Python3函数参数的各种形
  10. Spark RDD Python 学习笔记一