自定义:myListview
package com.example.listen.utils;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ListView;
public class MyListView extends ListView {
public MyListView(Context paramContext) {
super(paramContext);
}
public MyListView(Context paramContext, AttributeSet paramAttributeSet) {
super(paramContext, paramAttributeSet);
}
public MyListView(Context paramContext, AttributeSet paramAttributeSet,
int paramInt) {
super(paramContext, paramAttributeSet, paramInt);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
布局:
<ScrollView
android:id="@+id/sl_view_top"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="@+id/fgx1" >
<com.example.listen.utils.MyListView
android:id="@+id/listview_chatting"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:listSelector="#0000"
android:divider="#0000"
android:dividerHeight="5dp"
android:scrollbars="none"
android:cacheColorHint="#0000"/>
</ScrollView>