当前位置: 代码迷 >> Android >> get screen size of android device in onCreate activity method
  详细解决方案

get screen size of android device in onCreate activity method

热度:570   发布时间:2016-05-01 14:40:36.0
get screen size of android device in onCreate activity method.
[sourcecode language="java"]
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
int ht;
int wt;
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
ht = displaymetrics.heightPixels;
wt = displaymetrics.widthPixels;
}
[/sourcecode]
  相关解决方案