获取android 手机屏幕的大小以及动态设置背景图片的两种方法;

来源:互联网 发布:数据库存储多个坐标 编辑:程序博客网 时间:2024/05/01 01:42
DisplayMetrics dm = new DisplayMetrics();getWindowManager().getDefaultDisplay().getMetrics(dm);width = dm.widthPixels;//宽度height = dm.heightPixels ;//高度动态设置背景图片的两种方法;       Drawable d= getResources().getDrawable(R.drawable.test);//R.drawable.test2;       imgaeView.setImageDrawable(d);       //    imgaeView.setBackgroundResource(R.drawable.test2);
0 0
原创粉丝点击