猜纸牌游戏之一 界面设计和资源文件的设计
2016-06-22 21:43
344 查看
本游戏实现安卓手机下的猜纸牌游戏,由电脑和玩家一起玩,进行随机扑克的猜测,得分!
一:定义字符串的资源文件
主界面
调用图片xml
排行榜.xml
一:定义字符串的资源文件
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">纸牌游戏</string> <string name="action_settings">Settings</string> <string name="hello_world">Hello world!</string> <string name="show1">请单机获取按钮,来得到你的牌,并通过输入你现有的牌的数字并点击确定来进行游戏。每张纸牌只能使用1次!</string> <string name="tishi">请输入你的用户名!</string> <string name="ok">确定</string> <string name="gameguize"></string> </resources>
主界面
<RelativeLayout 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:background="@drawable/backe" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".MainActivity" > <ImageView android:id="@+id/ivcpu" android:layout_width="105dp" android:layout_height="150dp" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:src="@drawable/img16" /> <ImageView android:id="@+id/ivcm" android:layout_width="105dp" android:layout_height="150dp" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="64dp" android:src="@drawable/img16" /> <EditText android:id="@+id/edtcm" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignBottom="@+id/ivcm" android:layout_toLeftOf="@+id/ivcpu" android:background="#00ff00" android:ems="10" android:inputType="number" android:textSize="40sp" > <requestFocus /> </EditText> <TextView android:id="@+id/tvshow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/ivcm" android:layout_alignLeft="@+id/ivcm" android:layout_alignTop="@+id/ivcpu" android:layout_toLeftOf="@+id/btnget" android:text="@string/show1" android:textColor="#ffffff" android:textSize="20sp" /> <Button android:id="@+id/buttonok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/edtcm" android:layout_alignLeft="@+id/edtcm" android:text="@string/ok" /> <ListView android:id="@+id/lvcmsz" android:layout_width="80dp" android:layout_height="200dp" android:background="#ffffff" android:layout_alignTop="@+id/ivcm" android:layout_toRightOf="@+id/buttonok" > </ListView> <Button android:id="@+id/btnget" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/tvshow" android:layout_toLeftOf="@+id/lvcmsz" android:text="获取" /> </RelativeLayout>
调用图片xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" > <TextView android:id="@+id/tvshow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginTop="42dp" android:text="@string/show1" android:textSize="20sp" /> <EditText android:id="@+id/edtcm" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignLeft="@+id/ivcm" android:layout_below="@+id/ivcm" android:layout_marginTop="50dp" android:background="#00ff00" android:maxLength="2" android:ems="10" android:inputType="number" android:textSize="40sp" /> <Button android:id="@+id/buttonok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/edtcm" android:layout_toRightOf="@+id/edtcm" android:text="@string/ok" /> <Button android:id="@+id/btnget" android:layout_width="80dp" android:layout_height="80dp" android:layout_alignTop="@+id/ivcpu" android:layout_marginTop="27dp" android:layout_toRightOf="@+id/ivcm" android:background="@drawable/pk" android:text="PK" android:textColor="#ffff00" android:textSize="70px"/> <ImageView android:id="@+id/ivcm" android:layout_width="105dp" android:layout_height="150dp" android:layout_alignLeft="@+id/tvshow" android:layout_alignTop="@+id/ivcpu" android:src="@drawable/img16" /> <ImageView android:id="@+id/ivcpu" android:layout_width="105dp" android:layout_height="150dp" android:layout_below="@+id/tvshow" android:layout_marginTop="15dp" android:layout_toRightOf="@+id/btnget" android:src="@drawable/img16" /> </RelativeLayout>
排行榜.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" > <TextView android:id="@+id/tvshow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginTop="42dp" android:text="@string/show1" android:textSize="20sp" /> <EditText android:id="@+id/edtcm" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignLeft="@+id/ivcm" android:layout_below="@+id/ivcm" android:layout_marginTop="50dp" android:background="#00ff00" android:maxLength="2" android:ems="10" android:inputType="number" android:textSize="40sp" /> <Button android:id="@+id/buttonok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/edtcm" android:layout_toRightOf="@+id/edtcm" android:text="@string/ok" /> <Button android:id="@+id/btnget" android:layout_width="80dp" android:layout_height="80dp" android:layout_alignTop="@+id/ivcpu" android:layout_marginTop="27dp" android:layout_toRightOf="@+id/ivcm" android:background="@drawable/pk" android:text="PK" android:textColor="#ffff00" android:textSize="70px"/> <ImageView android:id="@+id/ivcm" android:layout_width="105dp" android:layout_height="150dp" android:layout_alignLeft="@+id/tvshow" android:layout_alignTop="@+id/ivcpu" android:src="@drawable/img16" /> <ImageView android:id="@+id/ivcpu" android:layout_width="105dp" android:layout_height="150dp" android:layout_below="@+id/tvshow" android:layout_marginTop="15dp" android:layout_toRightOf="@+id/btnget" android:src="@drawable/img16" /> </RelativeLayout>保存信息.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center" android:background="@drawable/backe" > <TextView android:id="@+id/tvtishi" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="纸牌游戏!" android:textSize="30sp" android:textColor="#ffffff" /> <EditText android:id="@+id/edtusename" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/tishi" android:maxLength="5" android:text="" android:textColor="#ffffff" /> <Button android:id="@+id/btnlogin" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登陆" android:textColor="#ffffff" /> </LinearLayout>
相关文章推荐
- Python Curses
- 猜纸牌游戏之一 界面设计和资源文件的设计
- Vim 7.4.1952 with Python/Ruby/Lua/Perl/C Syntax built for Ubuntu 16.04 x86_64
- oracle调整表中列顺序
- Bzoj2178:圆的面积并:Simpson积分
- 3.bash的学习(2)
- Program4_H
- java动态代理
- 大型网站技术架构——技术的演进
- postgresql----表分区
- codeforces 680E Bear and Square Grid 巧妙暴力
- 清代以来闽南宗族与乡村治理变迁———以南安大庭戴氏为例
- mac 安装 POCO 并且导入lib到 xcode
- 四旋翼入门
- 菜鸟小项目_拦截器的应用
- UI控件之RatingBar(星级评分条)
- mysql使用硬链接配合truncate 删除2.2T的表 --杨奇龙
- C++ 构造中调用构造
- debian系(Ubuntu)安装jenkins(持续集成)
- redis数据类型和应用场景