0

I have a FrameLayout and inside it I have a GridView. Then I need to add a progress bar after the grid view at the bottom after GridView like loading, but the progress bar is coming ontop of GridView. Below is my code.

I am using TabHost which contains tab widget for tabs(3) and FrameLayout for GridView as below:

<

    FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent"
                    android:layout_below="@+id/EmptyFonesLayout" >
                    <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:verticalSpacing="4dp" android:horizontalSpacing="4dp" android:numColumns="auto_fit" android:columnWidth="90dp" android:stretchMode="columnWidth" android:gravity="center_horizontal" 
                        android:textFilterEnabled="true" android:background="#00ffff"/>

                   <RelativeLayout
                            android:id="@+id/linlaProgressBar"
                            android:layout_width="fill_parent"
                            android:layout_height="20dp"
                            android:orientation="horizontal"
                            android:layout_gravity="bottom"
                            android:gravity="center"
                            android:background="#00FFFF"
                            android:visibility="gone"
                            android:layout_alignParentBottom="true">

                            <!-- android:layout_below="@+id/gridview" -->


                 <ProgressBar
                            style="?android:attr/progressBarStyleSmall"
                            android:layout_width="20dp"
                            android:layout_height="20dp"/>

                 <TextView 
                            android:id="@+id/emptyfonetext"
                            android:text="Loading"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:paddingLeft="10dp"
                            android:paddingRight="15dp"
                            android:textSize="16dp"/>
                </RelativeLayout>    -->
               </FrameLayout>
user1940676
  • 4,348
  • 9
  • 44
  • 73
user1340801
  • 423
  • 3
  • 10
  • 21

1 Answers1

0

You can try this :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <GridView
        android:id="@+id/gridView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/progressBar"
        android:layout_centerHorizontal="true"
        android:numColumns="3" >
    </GridView>

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleSmall"
        android:layout_width="20dp"
        android:layout_height="20dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

    <TextView
        android:id="@+id/emptyfonetext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/gridView"
        android:layout_marginLeft="10dp"
        android:layout_toRightOf="@+id/progressBar"
        android:text="Loading"
        android:textSize="16dp" />

</RelativeLayout>

GridView on top, progress bar on bottom with the loading text on right.

result

flav
  • 593
  • 6
  • 10
  • Hi.. thanks for the answer..according to this progressbar is on top of gridview..i want it below gridview..for example if u scroll u will get gridview attached to progressbar not ontop of it. – user1340801 Dec 10 '12 at 11:02
  • I'm sorry but I don't understand what do you expect ... Anyway, if you scroll the gridview, the "loading bar" will always be visible. – flav Dec 10 '12 at 11:23
  • yes ..i get the loading bar..but it comes ontop of gridview..like thegridview is in background..i need it to be like in google play.. – user1340801 Dec 10 '12 at 11:29
  • oh got it, you want this ;) http://stackoverflow.com/questions/10923034/endless-gridview – flav Dec 10 '12 at 11:35
  • I tried that..its coming same as above.(progressbar ontop of gridview):( – user1340801 Dec 10 '12 at 12:06
  • 2 solutions : - custom component extending the GridView - use a GridView, ScrollListener and deal with visibility of loading view (on bottom) – flav Dec 10 '12 at 13:35