标签:
string.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">2048Game</string> <string name="curScore">得分:</string> <string name="welcome">2048</string> <string name="begin_game">开始游戏</string> <string name="exit_game">退出</string> </resources>
AndroidMianfest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.my2048game" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".WelcomeActivity" android:label="@string/app_name" android:screenOrientation="portrait" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".MainActivity" > </activity> </application> </manifest>
layout/welcome.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="center" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="50dp" android:text="@string/welcome" /> <Button android:id="@+id/btn_begingame" android:layout_width="wrap_content" android:text="@string/begin_game" android:layout_height="wrap_content" android:onClick="BeginGameOnClick" /> </LinearLayout> </LinearLayout>
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/main_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.test.my2048game.MainActivity" tools:ignore="MergeRootFrame" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/curScore" /> <TextView android:id="@+id/tv_curscore" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ff0000" android:layout_weight="1"/> <Button android:id="@+id/btn_exitgame" android:text="@string/exit_game" android:layout_width="wrap_content" android:onClick="ExitGameOnClick" android:gravity="right" android:layout_height="wrap_content" /> </LinearLayout> <com.test.my2048game.GameMainView android:id="@+id/game_main_view" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" > </com.test.my2048game.GameMainView> </LinearLayout>
标签:
原文地址:http://www.cnblogs.com/2015android/p/4663985.html