Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 2nd, 2012  |  syntax: None  |  size: 3.15 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Listview below listview android
  2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.     android:layout_width="fill_parent" android:layout_height="fill_parent">
  4.  
  5.         <LinearLayout android:id="@+id/header"
  6.             android:background="@drawable/app_topbar" android:layout_width="fill_parent"
  7.             android:orientation="horizontal" android:layout_height="wrap_content"
  8.             android:layout_alignParentTop="true">
  9.  
  10.             <TextView android:text="@string/headline_notused"
  11.                 android:gravity="center" android:textSize="24sp" android:textStyle="bold"
  12.                 android:textColor="@color/txtcolor" android:layout_width="fill_parent"
  13.                 android:layout_height="fill_parent"></TextView>
  14.  
  15.         </LinearLayout>
  16.  
  17.         <ProgressBar android:layout_width="fill_parent"
  18.             android:layout_height="wrap_content" android:layout_below="@+id/header"
  19.             android:visibility="gone" style="?android:attr/progressBarStyleHorizontal"
  20.             android:id="@+id/progressbarHorizontal" />
  21.  
  22.         <ListView android:id="@+id/notUsedList" android:divider="@android:color/transparent"
  23.             android:dividerHeight="5dip" android:layout_height="wrap_content"
  24.             android:layout_marginBottom="5dip" android:layout_width="fill_parent"
  25.             android:layout_weight="1"
  26.             android:layout_below="@+id/progressbarHorizontal"></ListView>
  27.  
  28.         <LinearLayout android:orientation="vertical"
  29.             android:layout_below="@+id/notUsedList" android:background="@drawable/app_background"
  30.             android:layout_marginBottom="55dip" android:layout_width="fill_parent"
  31.             android:layout_height="fill_parent">
  32.  
  33.             <LinearLayout android:id="@+id/myUsedHeader"
  34.                 android:background="@drawable/app_topbar" android:layout_marginTop="10dip"
  35.                 android:layout_width="fill_parent" android:orientation="horizontal"
  36.                 android:layout_height="wrap_content" android:layout_alignParentTop="true">
  37.  
  38.                 <TextView android:text="@string/headline_used" android:gravity="center"
  39.                     android:textSize="24sp" android:textStyle="bold" android:textColor="@color/txtcolor"
  40.                     android:layout_width="fill_parent" android:layout_height="fill_parent"></TextView>
  41.  
  42.             </LinearLayout>
  43.  
  44.             <ListView android:id="@+id/usedList"
  45.                 android:divider="@android:color/transparent" android:dividerHeight="5dip"
  46.                 android:layout_height="fill_parent" android:layout_width="fill_parent"></ListView>
  47.  
  48.         </LinearLayout>
  49. </RelativeLayout>
  50.        
  51. // Initialization stuff.
  52. yourListView.setOnScrollListener(this);
  53.  
  54. // ... ... ...
  55.  
  56. @Override
  57. public void onScroll(AbsListView lw, final int firstVisibleItem,
  58.                  final int visibleItemCount, final int totalItemCount) {
  59.  
  60.     switch(lw.getId()) {
  61.         case android.R.id.list:    
  62.  
  63.             final int lastItem = firstVisibleItem + visibleItemCount;
  64.             if(lastItem == totalItemCount) {
  65.                 // Last item is fully visible. You will then need to start a New activity, maybe... Or change the layout.. I don't know!
  66.             }
  67.     }
  68. }