ViewSwitcher mit TableLayouts

  • 0 Antworten
  • Letztes Antwortdatum
H

h00ligan

Neues Mitglied
0
Hey Leute :)

Ich versuche mich momentan an einem ViewSwitcher der zwischen mehreren Tabelle (TabelLayouts) switchen soll.

"Switchen" tue ich momentan so:
ViewSwitcher switcher = (ViewSwitcher) findViewById(R.id.viewSwitcher1);
per button-click:
switcher.showPrevious();
switcher.showNext();

So sieht meine XML-Datei bisher aus:
Code:
<ViewSwitcher
        android:id="@+id/viewSwitcher1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
        
        <RelativeLayout
    		android:layout_width="match_parent"
    		android:layout_height="wrap_content">
    		
    		<TableLayout
	        	android:id="@+id/table1"
	        	android:layout_width="match_parent"
	        	android:layout_height="wrap_content" >
	        	
	        	<TableRow
	            	android:id="@+id/row12"
	           		android:layout_width="wrap_content"
	            	android:layout_height="wrap_content" >
	
	            	<TextView
	                	android:id="@+id/tv11"
	                	android:layout_width="match_parent"
	                	android:layout_height="wrap_content"
	                	android:layout_weight="50"
	                	android:text="Verteiler"/>
	            	
	            	<TextView
	                	android:id="@+id/tv12"
	                	android:layout_width="match_parent"
	                	android:layout_height="wrap_content"
	                	android:layout_weight="50"
	                	android:text="Test111"/>
	        	</TableRow>
	        
	    </TableLayout>

		</RelativeLayout>

		<RelativeLayout
    		android:layout_width="match_parent"
    		android:layout_height="wrap_content" >
    		<TableLayout
	        	android:id="@+id/table2"
	        	android:layout_width="match_parent"
	        	android:layout_height="wrap_content" >
	        	
	        	<TableRow
	            	android:id="@+id/row22"
	           		android:layout_width="wrap_content"
	            	android:layout_height="wrap_content" >
	
	            	<TextView
	                	android:id="@+id/tv21"
	                	android:layout_width="match_parent"
	                	android:layout_height="wrap_content"
	                	android:layout_weight="50"
	                	android:text="Verteiler"/>
	            	
	            	<TextView
	                	android:id="@+id/tv22"
	                	android:layout_width="match_parent"
	                	android:layout_height="wrap_content"
	                	android:layout_weight="50"
	                	android:text="Test222"/>
	        	</TableRow>
	        
	    </TableLayout>
		</RelativeLayout>
        
    </ViewSwitcher>

Leider verändern sich die Größen der einzelnen Zellen beim erneuten Aufruf per Switcher, sprich:
Jedes TableLayout wird nur beim 1. Aufuruf richtig angezeigt, falls man danach erneut zu diesem Layout springt, dann passt gar nichts mehr.

Woran kann das liegen?
Sind die Parameter für die TabelLayouts einfach nur falsch?

Gruß
 
Zurück
Oben Unten