Experiment 5 Sudoku Game Interface Design

Source: Internet
Author: User

Lab Report

Course Name

Android Development and practice

Date of experiment

2016.4.15

Name of the experimental project

Sudoku Game Interface Design

Location of the experiment

S3002

Type of experiment

-Verification Type √ design type-comprehensive type

Hours

The purpose and requirements of the experiment (the knowledge points which are involved in this experiment and are required to be mastered)

Purpose

Complete interface design for Sudoku games

Requirements

Mastering the use of Actionbar

second, the experimental environment (the hardware equipment and related software used in this experiment)

(1) PC Machine

(2) Operating system: Windows XP

(3) Software: Eclipse, jdk1.6,android Sdk,adt

Third, the contents and steps of the experiment

Principle

1) Use Actionbar to display optionmenu menu items MenuItem

2) navigating with program icons

3) Add Action View

Process

1) Import Project Sodoku

2) Add the following activity class

3) Add the following layout resource file

4) After the design is completed, the interface runs as follows

Initial interface:

New Game Interface: (Note: This interface is only the background, can be freely replaced, the same below)

Help interface:

About the interface:

Four, the experimental results (the experimental source program list and operating results or experimental conclusions, experimental design drawings)

Code:

Main.xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

<item

android:id="@+id/item1"

android:showasaction="Always"

Android:title = "Help">

</item>

<item

android:id="@+id/item2"

android:showasaction="Always"

Android:title = "About">

</item>

<item

android:id="@+id/item3"

android:showasaction="Always"

Android:title = "New Games">

</item>

<item

android:id="@+id/item4"

android:actionlayout="@layout/clock"

android:showasaction="Always"

Android:title = "Clock">

</item>

</menu>

Mainactivity.java:

Package Com.example.sukodu;

import android.app.Activity;

import android.content.Intent;

import Android.os.Bundle;

Import Android.util.Log;

import Android.view.Menu;

import Android.view.MenuInflater;

import Android.view.MenuItem;

Import Android.view.View;

Import Android.view.View.OnClickListener;

Import Android.widget.Button;

Import Android.widget.TextView;

Public class Mainactivity extends Activity {

@Override

protected void onCreate (Bundle savedinstancestate) {

Super. OnCreate (savedinstancestate);

Setcontentview (r.layout. Activity_main);

}

@Override

Public boolean oncreateoptionsmenu (Menu menu) {

TODO auto-generated Method stub

Menuinflater inflater = new menuinflater (this);

Inflater.inflate (R.menu. Main, menu);

return Super. Oncreateoptionsmenu (menu);

}

Public boolean onoptionsitemselected (MenuItem item) {

TODO auto-generated Method stub

Switch (Item.getitemid ()) {

case Android. R.id. Home:

Create a intent to start mainactivity

Intent intent=New Intent (This, mainactivity. Class);

Add additional flag to eject activity on the activity stack that is above mainactivity

Intent.addflags (Intent. Flag_activity_clear_top);

StartActivity (Intent);

break;

Case R.id. item1:

Intent intent1=New Intent (This, help. Class);

StartActivity (INTENT1);

break;

Case R.id. item2:

Intent intent2=New Intent (This, about. Class);

StartActivity (Intent2);

break;

Case R.id. item3:

Intent intent3=New Intent (This, newgame. Class);

StartActivity (INTENT3);

break;

default:

break;

}

return Super. onoptionsitemselected (item);

}

}

Run Result: ()

1.

Five, Experimental summary (analysis of the results of the experiment, experience and improvement of experimental ideas)

Through the experiment mastered the use of Actionbar, using Actionbar display optionmenu menu items MenuItem, in the experiment encountered problems by asking teachers, classmates to solve some small errors

Experimental reviews

Experimental results

Guide Teacher Signature: Date

Experiment 5 Sudoku Game Interface Design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.