幕布斯7183808
把图片放小一点啊,真是的
方天画戟
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.baiyun.pitu.MainActivity" android:background="#f79b11"> <GridLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/gl_main_game" android:columnCount="5" android:rowCount="3"></GridLayout> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/ic_game_tu" android:layout_marginRight="10dp" android:layout_marginLeft="10dp" android:layout_marginTop="200dp"/> </RelativeLayout>
莜莜栀洁
小莫程序学习
int displayWidthPixels = getResources().getDisplayMetrics().widthPixels; int displayHeightPixels = getResources().getDisplayMetrics().heightPixels; float density = getResources().getDisplayMetrics().density;
1、获取到屏幕像素宽度和高度;
2、获取到图片dpi宽高;
3、搜图片转换方法,将图片缩放到和屏幕大小一致。
danielyy
抱歉,慕课不许我发源码,你可以看看其它同学做的。
zzlandroid
照着老师的教程敲的一个样例:https://github.com/kiritozzl/PuzzleGame
王正一
我实现的项目源码:https://github.com/wangzhengyi/HYPinTu
慕粉3288933
我写了代码,地址在https://github.com/jowang2016/pintumooc 但是判断程序结束那里总是没有提示