在其他类中获取屏幕宽高

在View构造函数中获得屏幕的宽高

public class GameView extends View

  public GameView(Context context)
  {
    Display d = ((Activity) context).getWindowManager().getDefaultDisplay();
    Log.v(TAG,"W + H = "+d.getWidth()+" + "+d.getHeight());
  }
}

猜你喜欢

转载自blog.csdn.net/wfskxj/article/details/53083219
今日推荐