Project name : Sudoku
Package name : org.example.sudoku
Activity : Sudoku
Application name : Sudoku

More...
XML でユーザインタフェースを設定しているのが
res/layout/main.xml
これを書き換えれば OK
Sudoku/res/layout/main.xml
- <!--xml version="1.0" encoding="utf-8"?-->
- <linearlayout <brbr="">xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <textview <brbr=""> android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/main_title"
- />
- <button
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/continue_label"
- />
- <button
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/new_game_label"
- />
- <button
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/about_label"
- />
- <button
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/exit_label"
- />
- </button
- </button
- </button
- </button
- </textview></linearlayout>

もう少しカスタマイズ
Sudoku/res/layout/main.xml
- <!--xml version="1.0" encoding="utf-8"?-->
- <linearlayout <brbr="">xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="@color/background"
- android:orientation="horizontal"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:padding="30dip"
- >
- <linearlayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:orientation="vertical"
- >
- <textview <brbr=""> android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/main_title"
- android:layout_gravity="center"
- android:layout_marginBottom="25dip"
- android:textSize="24.5sp"
- />
- <button
- android:id="@+id/continue_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/continue_label"
- />
- <button
- android:id="@+id/new_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/new_game_label"
- />
- <button
- android:id="@+id/about_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/about_label"
- />
- <button
- android:id="@+id/exit_button"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/exit_label"
- />
- </button
- </button
- </button
- </button
- </textview></linearlayout
- </linearlayout>
Sudoku/res/values/colors.xml
- <!--xml version="1.0" encoding="utf-8"?-->
- <resources>
- <color name="background">#3500ffff</color>
- </resources>

横長モードだとはみ出してしまう
ちなみにエミュレータで横長モードにするには Ctrl + F11

ので、横長用のレイアウトを作る
Sudoku/res/layout-land/main.xml
- <!--xml version="1.0" encoding="utf-8"?-->
- <linearlayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:background="@color/background"
- android:layout_height="fill_parent"
- android:layout_width="fill_parent"
- android:padding="15dip"
- android:orientation="horizontal"
- >
- <linearlayout <brbr=""> android:orientation="vertical"
- android:layout_height="wrap_content"
- android:layout_width="fill_parent"
- android:layout_gravity="center"
- android:paddingLeft="20dip"
- android:paddingRight="20dip"
- >
- <textview
- android:text="@string/main_title"
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_gravity="center"
- android:layout_marginBottom="20dip"
- android:textSize="24.5sp"
- />
- <tablelayout
- android:layout_height="wrap_content"
- android:layout_width="wrap_content"
- android:layout_gravity="center"
- android:stretchColumns="*"
- >
- <tablerow>
- <button
- android:id="@+id/continue_button"
- android:text="@string/continue_label"
- />
- <button
- android:id="@+id/new_button"
- android:text="@string/new_game_label"
- />
- </button
- </button
- </tablerow>
- <tablerow>
- <button
- android:id="@+id/about_button"
- android:text="@string/about_label"
- />
- <button
- android:id="@+id/exit_button"
- android:text="@string/exit_label"
- />
- </button
- </button
- </tablerow>
- </tablelayout
- </textview
- </linearlayout>
- </linearlayout
直った

0 件のコメント:
コメントを投稿