package com.kale.screen;import android.annotation.SuppressLint;import android.app.Activity;import android.graphics.Point;import android.os.Bundle;import android.util.Log;import android.view.Display;public class MainActivity extends Activity {    @SuppressLint("NewApi")    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);                int dw = getWindowManager().getDefaultDisplay().getWidth();//获得手机屏幕的宽度        int dh = getWindowManager().getDefaultDisplay().getHeight();//获得手机屏幕的高度                Log.i("h", "height:"+dw);        Log.i("w", "width:"+dh);                //推荐的获取屏幕长宽的方式,但需要API13        Display display = getWindowManager().getDefaultDisplay();        Point size = new Point();        display.getSize(size);        int windowHeight = size.y;        int windowWidth = size.x;                Log.i("w","width:"+ windowWidth);        Log.i("h", "height:"+ windowHeight);            }}

更多相关文章

  1. android之单选框
  2. android 图片圆角处理
  3. Android(安卓)WebView 图片自适应屏幕宽度
  4. android 获得当前活动的Acticity
  5. android获取手机屏幕的宽度及高度
  6. Android(安卓)ContextMenu和Listview配合使用
  7. Android获取屏幕宽和高
  8. 【Android】debug 状态下其签名文件 debug.keystore 相关(如何获
  9. Android(安卓)实现QQ第三方登录

随机推荐

  1. 闲聊 Android 异步任务
  2. Android任务、进程、线程的关系
  3. android box2d重力系统 碰撞检查(二)
  4. [置顶] android中图片的三级cache策略(内
  5. [置顶] Android面试必须要知道的事情
  6. 彻底理解Android中的ThreadLocal
  7. Android 功耗优化(4)---android 7.0低电耗D
  8. Android 开发之短信的收发及在android模
  9. Android Tween动画之RotateAnimation实现
  10. Android小项目之十 应用程序更新的签名问