This is what the book says I need copied straight from the .pdf version --
- Code: Select all
<?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="30dip"
android:orientation="horizontal" >
<LinearLayout // This is what is bugging and messing up saying it is useless and not needed. I delete it then layout_hieght width will duplicate and bug up thus delete those to make it "run" //
android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center" >
<TextView
android:text="@string/main_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
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" />
</LinearLayout>
</LinearLayout>
This is what I have to make it work where it displays all the buttons I fixed it a tad bit still doesn't look 100% like it should. I got rid of the 2nd <LinearLayout so the background color will only fill part of the screen. Not all of it as I am trying.
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/backgroundX"
android:layout_width="fill_parent"
android:padding="30dip"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_gravity="center" >
<TextView
android:text="@string/main_title"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="150dip"
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" />
</LinearLayout>
Log Cat (I don't know how to copy it, I guess I did it right, never really looked at it before as I don't know what it all means...)
- Code: Select all
01-20 13:12:17.147: D/InputEventConsistencyVerifier(735): 2: sent at 4408756000000, (unhandled) KeyEvent { action=ACTION_UP, keyCode=KEYCODE_DPAD_LEFT, scanCode=103, metaState=0, flags=0x80000008, repeatCount=0, eventTime=4408756, downTime=4408691, deviceId=0, source=0x301 }
Strings.xml code
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Sudoku</string>
<string name="main_title">Android Sudoku</string>
<string name="continue_label">Continue</string>
<string name="new_game_label">New Game</string>
<string name="about_label">About</string>
<string name="exit_label">Exit</string>
<string name="background">#3500ffff</string>
</resources>
colors.xml code (Only one color being changed)
- Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="backgroundX">#3500ffff</color>
</resources>
sudoku.java code (I have done nothing to it, I don't think the book said anything about this yet coding wise.)
- Code: Select all
package org.example.sudoku;
import android.app.Activity;
import android.os.Bundle;
public class sudoku extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}