0
Well, I’m coding android, and building layouts for my app. My problem: I can’t make my app layout fit vertically to different devices.
my xml code:
```
<TableRow
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="50dp" >
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ToggleButton
android:id="@+id/toggleButton6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton8"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton9"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton10"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ToggleButton
android:id="@+id/toggleButton11"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton12"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton13"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton14"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
<ToggleButton
android:id="@+id/toggleButton15"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="ToggleButton" />
</TableRow>
<TableRow
android:id="@+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="" />
<Button
android:id="@+id/button1"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Button" />
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="TextView" />
<Button
android:id="@+id/button2"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
</TableRow>
```
I wish my buttons longed for size alone when the screen increases, horizontally it already happens due to the tablelayout stretchColumns but how do I make it occur in the vertical tbm?
thank you!
Joannis, take a look at my answer to that question: http://answall.com/questions/33393/como-cria-bot%C3%B5es-with-size-din%C3%A2mico-em-xml/33416#33416. On it the buttons resize according to screen size and orientation.
– Wakim