0

I have a table of 19 columns and 10 rows.I have designed it on Gridlayout.maximum cell of that has one Imagebutton .I can see all my button.But my table is not taking full screen.It is taking only left side of screen.to scroll table I have used scrollview and horizontal scrollview.but my table is not fully stretched. so, what should i do.I have to show scrollable table with full screen.i am facing this this problem when i run it in tablet

main.xml

 <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
        <GridLayout 
         xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent"       
            android:alignmentMode="alignBounds"
            android:columnOrderPreserved="false"
            android:numColumns="auto_fit"
            android:gravity="center"
            android:stretchMode="columnWidth" >

        <ImageView
            android:layout_row="0"
            android:layout_column="0"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:id="@+id/block"
            android:src="@drawable/spdf"
             >       
        </ImageView>

       <!-- IMAGE ImageButton FOR Gr1 -->

             <ImageButton 
                android:layout_row="0"
                android:layout_column="1"    
                android:gravity="center"   
                android:background="@drawable/gr1"     
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr1"
                > </ImageButton> 

              <!-- IMAGE ImageButton FOR Gr2 -->

               <ImageButton        
                android:layout_row="0"
                android:layout_column="2"
                android:gravity="center"
                android:background="@drawable/gr2"    
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr2"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr3 -->

               <ImageButton  
                android:layout_row="0"
                android:layout_column="3"
                android:gravity="center"
                android:background="@drawable/gr3"          
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr3"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr4 -->

               <ImageButton
                android:layout_row="0"
                android:layout_column="4"
                android:gravity="center"
                android:background="@drawable/gr4"            
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr4"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr5 -->

               <ImageButton 
                android:layout_row="0"
                android:layout_column="5"
                android:gravity="center"
                android:background="@drawable/gr5"           
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr5"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr6 -->

              <ImageButton  
                android:layout_row="0"
                android:layout_column="6"
                android:gravity="center"
                android:background="@drawable/gr6"          
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr6"
                > </ImageButton>

               <!-- IMAGE ImageButton FOR Gr7 -->

               <ImageButton  
                android:layout_row="0"
                android:layout_column="7"
                android:gravity="center" 
                android:background="@drawable/gr7"         
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr7"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr8 -->

               <ImageButton  
                android:layout_row="0"
                android:layout_column="8"     
                android:gravity="center"
                android:background="@drawable/gr8"     
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr8"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr9 -->

               <ImageButton  
                android:layout_row="0"
                android:layout_column="9"      
                android:gravity="center"
                android:background="@drawable/gr9"    
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr9"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr10 -->

               <ImageButton 
                android:layout_row="0"
                android:layout_column="10" 
                android:gravity="center"   
                android:background="@drawable/gr10"       
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr10"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr11 -->

               <ImageButton    
                android:layout_row="0"
                android:layout_column="11"
                android:gravity="center"
                android:background="@drawable/gr11"        
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr11"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr12 -->

               <ImageButton 
                android:layout_row="0"
                android:layout_column="12"   
                android:gravity="center"    
                android:background="@drawable/gr12"    
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr12"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr13 -->

               <ImageButton
                android:layout_row="0"
                android:layout_column="13"
                android:gravity="center"
                android:background="@drawable/gr13"            
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr13"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr14 -->

               <ImageButton 
                android:layout_row="0"
                android:layout_column="14"
                android:gravity="center"
                android:background="@drawable/gr14"           
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr14"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr15 -->

               <ImageButton  
                android:layout_row="0"
                android:layout_column="15" 
                android:gravity="center"
                android:background="@drawable/gr15"         
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr15"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr16 -->

               <ImageButton 
                android:layout_row="0"
                android:layout_column="16"  
                android:gravity="center"     
                android:background="@drawable/gr16"    
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr16"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr17 -->

              <ImageButton 
                android:layout_row="0"
                android:layout_column="17"
                android:gravity="center"
                android:background="@drawable/gr17"           
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"    
                android:id="@+id/Gr17"
                > </ImageButton>

                <!-- IMAGE ImageButton FOR Gr18 -->

            <ImageButton 
                android:layout_row="0"
                android:layout_column="18"
                android:gravity="center"
                android:background="@drawable/gr18"    
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dip"
                android:layout_marginRight="1dip"
                android:layout_marginBottom="1dip"
                android:id="@+id/Gr18"
                ></ImageButton>
            </GridLayout>


    </LinearLayout>
Sanjoy Saha
  • 133
  • 3
  • 14

1 Answers1

0

You are in control over your row heights, by virtue of what you put in them. Since your cells appear to have more than one widget, they are presumably wrapped in a LinearLayout or something. Set your LinearLayouts to be some specific height, and the rows will all be that height.

Personally, I think you should be resizing your images if you are going to have text above and below each image on a per-cell basis.

With the Reference enter link description here

Community
  • 1
  • 1
Parag Chauhan
  • 35,760
  • 13
  • 86
  • 95