俄罗斯方块Tetris是一款很经典的益智游戏,之前就做了一款桌面版的java俄罗斯方块,这次就尝试着写了一款适用于Android平台的俄罗斯方块。
整个程序设计十分简洁,只是运用了两个类而已,最终做出的效果图如下所示:
首先,要考虑的自然是游戏应该如何布局的问题了。我的想法是将手机屏幕分为上下两部分,上边用来显示游戏者的名称、所得分数以及下一个方块,称为“文字区域”,下边自然就是游戏区域了。
如图所示:
布局文件如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/linear" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/three" android:orientation="vertical" android:padding="25px" > <TextView android:id="@+id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/hh"/> <TextView android:id="@+id/text2" android:layout_width="match_parent" android:layout_height="wrap_content" android:height="30px" /> <FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" > </FrameLayout> </LinearLayout>
当前题目:一款适用于Android平台的俄罗斯方块-创新互联
本文链接:https://www.cdcxhl.com/article24/dsjpce.html
成都网站建设公司_创新互联,为您提供网站改版、全网营销推广、做网站、手机网站建设、响应式网站、网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联