Я пытаюсь создать макет для простой версии игры MasterMind. Я установил TableLayout с 10 TableRows с одинаковым вертикальным весом для представления колышек и последней большой строкой внизу. Каждый из основных 10 рядов состоит из 4 элементов Button (равного веса) и двух видов по бокам, так что кнопки остаются центрированными. У меня уже есть макет, который, как мне кажется, должен работать, но в настоящее время будет отображаться только 9 строк (остальные существуют, только за пределами экрана).Android TableLayout не отображает все 11 TableRows
Может кто-нибудь помочь мне понять, почему не все элементы отображаются? Я бы сделал серию LinearLayouts, но я слышал, что это не очень эффективно, хотя я не уверен, что мой текущий метод тоже.
Я в надежде получить что-то вдоль линий этого:
но вместо я получаю это:
Вот макет (извините, что длинно/повторяющийся):
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
android:id="@+id/game_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#b3b3b3"
android:orientation="vertical">
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<Button
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="1"/>
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal">
<View
android:layout_height="fill_parent"
android:layout_width="0dp"
android:layout_weight="2"/>
</TableRow>
</TableLayout>
положить в прокрутку. – Meenal