工具-尺寸、大小

将设计在苹果的宽高转换成Android的宽高

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public class IOSDisplayTransfer {
/**
* 将设计在苹果的高度转换成android的高度
*/
public static int caculateHeightFromApple(Context context, int appleHeight)
{
int rw = DimensUtil.getDisplayWidth(context);
int height = appleHeight * rw / 750;
return height;
}

/**
* 将设计在苹果的高度转换成android的高度
*
* @param androidWidth android中的屏幕宽度
* @param appleHeight 苹果中的设计高度
*/
public static int caculateHeightFromApple(int androidWidth, int appleHeight)
{
int height = appleHeight * androidWidth / 750;
return height;
}

/**
* 换算宽度
* @param context
* @param width
* @return
*/
public static int caculateWidthFromApple(Context context, int width)
{
int rw = DimensUtil.getDisplayWidth(context);
return rw * width / 750;
}
}