/** * Created by ${xsy} on 2016/5/4. * 新建一个类继承ListView并重写onMeasure方法 */ public class MyListView extends ListView { public MyListView(Context context) { super(context); } public MyListView(Context context, AttributeSet attrs) { super(context, attrs); } public MyListView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { heightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,MeasureSpec.AT_MOST); super.onMeasure(widthMeasureSpec, heightMeasureSpec); } }
Android ScrollView嵌套ListView,ListView只显示一行或不显示的解决办法
最新推荐文章于 2022-06-13 15:25:56 发布