1

Suduko ソルバー アプリに取り組んでいます。レイアウトに 9 つの Gridviews で 9x9 の TextView が必要です。それらの下に 2 つのボタン (解決、クリア) を配置します。作ったけど小さい端末だと動かないかも(ボタンが見えない、グリッドビューがスクロール可能になっていて画面に収まらない)

Textviews を Gridview に追加する方法は次のとおりです

gridView = (GridView) findViewById(R.id.gridView1);
String[] arrayEmpty = new String[] {"", "", "", "", "", "", "", "", ""};
ArrayList<String> listEmpty = new ArrayList<String>(Arrays.asList(arrayEmpty));
gridView.setAdapter(new ArrayAdapter<String>(this,R.layout.list_item,list));

これが私のLayout.XMLです

<?xml version="1.0" encoding="utf-8"?>

<TableRow android:id="@+id/tableRow1"
    android:layout_width="match_parent"
    android:background="#999999"
    android:layout_weight="1"
    android:layout_height="match_parent">

    <GridView
    android:id="@+id/gridView1"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
    </GridView>

    <GridView
    android:id="@+id/gridView2"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
</GridView>

<GridView
    android:id="@+id/gridView3"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
</GridView>

<TableRow android:id="@+id/tableRow2"
    android:layout_width="match_parent"
    android:background="#999999"
    android:layout_weight="1"
    android:layout_height="match_parent">

    <GridView
    android:id="@+id/gridView4"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
    </GridView>

    <GridView
    android:id="@+id/gridView5"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
</GridView>

<GridView
    android:id="@+id/gridView6"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
</GridView>

<TableRow android:id="@+id/tableRow3"
    android:layout_width="match_parent"
    android:background="#999999"
    android:layout_height="match_parent"
    android:layout_weight="1"
    android:layout_marginBottom="15dp">

    <GridView
    android:id="@+id/gridView7"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
    </GridView>

    <GridView
    android:id="@+id/gridView8"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
</GridView>

<GridView
    android:id="@+id/gridView9"
    android:clickable="true"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:background="#5C5C5C"
    android:layout_weight="1"
    android:numColumns="3" >
</GridView>

<TableRow android:layout_weight="1" android:layout_height="match_parent">
    <Button
        android:id="@+id/solve_button"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight="1"
        android:text="@string/solve" />
    <Button
        android:id="@+id/clear_button"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="5dp"
        android:layout_weight="1"
        android:text="@string/_clear" />
</TableRow>

そして、これは私が持っていたもののスクリーンショットですここに画像の説明を入力

しかし、これは私のレイアウトがすべてのデバイスで必要なものです。ウェイトを使用する必要があるかもしれませんが、方法がわかりません

ここに画像の説明を入力

4

2 に答える 2