如何最大化我在某人的教程上获得的该程序的宽度。
这是代码:
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
width = (w < h)?w:h;
height = width; //for now square mazes
lineWidth = 1; //for now 1 pixel wide walls
cellWidth = (width - ((float)mazeSizeX*lineWidth)) / mazeSizeX;
totalCellWidth = cellWidth+lineWidth;
cellHeight = (height - ((float)mazeSizeY*lineWidth)) / mazeSizeY;
totalCellHeight = cellHeight+lineWidth;
gold.setTextSize(cellHeight*0.75f);
super.onSizeChanged(w, h, oldw, oldh);
任何答案将不胜感激,谢谢!
最佳答案
我刚刚得到了一个答案:)
//new value
height = width+(width/2);
关于android - 如何将宽度与实际屏幕匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23697195/