2016-05-23 15 views
0

Ich habe eine Tabelle namens „Grid“, innerhalb der eigenen Klasse erstellen ... wie folgen aus:Insert Tablelayout mit Bildlaufleisten in einem RelativeLayout

ScrollView contentView = new ScrollView(this); 
     contentView.setBackgroundColor(Color.LTGRAY); 

     // THIS IS OUR MAIN LAYOUT 
     mainLayout = new RelativeLayout(this); 

     // ADD MAINLAYOUT TO SCROLLVIEW (contentView) 

     contentView.addView(mainLayout); 

     // SET CONTENT VIEW 

     setContentView(contentView); 

     meTable = this.tableLayout(); 

     HorizontalScrollView HOR = new HorizontalScrollView(this); 

     mainLayout.addView(HOR); 

     HOR.addView(meTable); 

Diese die Tabelle erstellt, und fügt auch einen horizontalen und vertikalen Bildlauf , das ist toll ...

ich brauche aber all dies in einem anderen RelativeLayout, so zu setzen:

enter image description here

I c ein tun das, aber ohne die Bildlaufleisten, füge ich nur „meTable“, wie folgt aus:

Grid gr = new Grid(); 
     gr.Activate(this); 
     TableLayout tablita; 

     RelativeLayout layout = (RelativeLayout) findViewById(R.id.contenedorLay); 

     tablita = gr.meTable; 


     layout.addView(tablita); 

Wie füge ich die gesamte Tabelle mit ihren Rollbalken?

Antwort

0

an diesem Code Werfen Sie einen Blick, es funktioniert für mich:

<?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" > 
<ScrollView 
    android:id="@+id/layout" 
    android:layout_height="match_parent"   
    android:scrollbars="horizontal|vertical" 
    android:layout_width="match_parent"  
    android:layout_marginTop="5dip"  
    android:scrollbarStyle="outsideInset" 
    android:fillViewport="true"> 

    <HorizontalScrollView 
     android:id="@+id/horizontalView" 
     android:layout_height="wrap_content"  
     android:scrollbars="horizontal|vertical" 
     android:layout_width="wrap_content"  
     android:layout_marginTop="5dip"> 

     <TableLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/tlGridTable" > 
     </TableLayout> 
    </HorizontalScrollView> 
</ScrollView> 
</LinearLayout> 
+1

Wer Sie Papa kennt ?? – WhiteFloater