当第二个ListView添加上去的时候会调用getView()。当第一个Item画上布局的时候,形成了冲突。
解决办法,自定义一个ListView继承系统的ListView。然后在根标签用<pre name="code" class="java"><pre name="code" class="java"><<span style="font-family: Arial, Helvetica, sans-serif;">com.example.user.custem </span>
package com.example.user.custem;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;
public class RecommendLargeListView extends ListView {
public RecommendLargeListView(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE>>2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, height);
}
}