Android game development interface design (2)

Source: Internet
Author: User


----------------------------------------------. Xml
<? Xml version = "1.0" encoding = "UTF-8"?>
<FrameLayout
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Xmlns: android = "http://schemas.android.com/apk/res/android">
<ImageView
Android: id = "@ + id/mainMenuBackground"
Android: src = "@ drawable/title_background"
Android: adjustViewBounds = "true"
Android: gravity = "center_vertical"
Android: scaleType = "fitXY"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"/>


<LinearLayout
Android: background = "@ drawable/custom_toast_border"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: orientation = "vertical"
Android: layout_gravity = "center"
Android: padding = "10dp">

<ImageView
Android: id = "@ + id/babyButton"
Android: src = "@ drawable/ui_button_baby"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_gravity = "center_horizontal"
Android: clickable = "true"/>

<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: textColor = "# FFFFFF"
Android: textSize = "14sp"
Android: focusable = "false"
Android: layout_gravity = "center_horizontal"
Android: text = "What is the speed of low access points? How much water"
Android: id = "@ + id/babyText"/>

<ImageView
Android: id = "@ + id/kidsButton"
Android: src = "@ drawable/ui_button_kids"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_gravity = "center_horizontal"
Android: clickable = "true"
Android: layout_marginTop = "15dp"/>

<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: textColor = "# FFFFFF"
Android: textSize = "14sp"
Android: focusable = "false"
Android: layout_gravity = "center_horizontal"
Android: text = "@ string/kids_description"
Android: id = "@ + id/kidsText"/>

<ImageView
Android: id = "@ + id/adultsButton"
Android: src = "@ drawable/ui_button_adults"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_gravity = "center_horizontal"
Android: clickable = "true"
Android: layout_marginTop = "15dp"/>

<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: textColor = "# FFFFFF"
Android: textSize = "14sp"
Android: focusable = "false"
Android: layout_gravity = "center_horizontal"
Android: text = "@ string/adults_description"
Android: id = "@ + id/adultsText"/>

</LinearLayout>
</FrameLayout>


----------------------------------------- Drawable/custom_toast_border Linearlayou Layout
<? Xml version = "1.0" encoding = "UTF-8"?>
<! -- Thanks to http://hustleplay.wordpress.com/2009/07/23/replicating-default-android-toast! -->
<Shape xmlns: android = "http://schemas.android.com/apk/res/android">


<Solid android: color = "#99000000"/>
<Padding
Android: left = "40dp"
Android: top = "40dp"
Android: right = "40dp"
Android: bottom = "40dp"/>
<Corners android: radius = "10dp"/>
</Shape>

 

 

--------------------------. Java
Package com. example. xiang1;

 

 

 

 


Import android. app. Activity;
Import android. content. Intent;
Import android. OS. Bundle;
Import android. view. View;
Import android. view. View. OnClickListener;
Import android. view. animation. Animation;


Public class MainActivity extends Activity {
Private Animation mButtonFlickerAnimation;
Private boolean mPaused;
Private View mTicker;
Private Animation mAlternateFadeOutAnimation;
Private View mStartButton;


@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. activity_main );


MTicker = findViewById (R. id. ticker );
If (mTicker! = Null ){


MTicker. setFocusable (true );
MTicker. requestFocus ();
MTicker. setSelected (true );


}

 

 

MStartButton = findViewById (R. id. startButton );
MStartButton. setOnClickListener (new OnClickListener (){


Public void onClick (View v ){
// TODO Auto-generated method stub


Intent I = new Intent (MainActivity. this,
DifficultyMenuActivity. class );
StartActivity (I );


}


});


}


@ Override
Protected void onResume (){
// TODO Auto-generated method stub
Super. onResume ();


}
}

 

 

----------------- DifficultyMenuActivity. java enters the second interface at the beginning of the game.
Package com. example. xiang1;


Import android. app. Activity;
Import android. OS. Bundle;


Public class DifficultyMenuActivity extends Activity {
@ Override
Protected void onCreate (Bundle savedInstanceState ){
// TODO Auto-generated method stub
Super. onCreate (savedInstanceState );
SetContentView (R. layout. difficulty_menu );
}


}

Related Article

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.