Buat custom ListView tanpa fitur scroll.
package al.akh.example.testing.view;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
import android.widget.ListView;
public class ListViewNonScroll extends ListView {
public ListViewNonScroll(Context context) {
super(context);
}
public ListViewNonScroll(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ListViewNonScroll(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
ViewGroup.LayoutParams params = getLayoutParams();
params.height = getMeasuredHeight();
}
}
Pada layout resource file, gunakan custom ListView yang telah dibuat di atas.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fadingEdgeLength="0dp"
android:fillViewport="true"
android:overScrollMode="never"
android:scrollbars="none" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<al.akh.example.testing.view.ListViewNonScroll
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"/ >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/list_view" >
...
</RelativeLayout>
</RelativeLayout>
</ScrollView>





Users Today : 186
Users Yesterday : 346
This Month : 532
This Year : 93430
Total Users : 157917
Views Today : 498
Total views : 698141
Who's Online : 1
Recent Comments