FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
WindowManager wm = getWindowManager();
Display d = wm.getDefaultDisplay();
if(d.getWidth()>d.getHeight()){
}
为什么getWidth()
不起作用? :(
答案 0 :(得分:2)
在API级别13中不推荐使用getHeight()和getWidth()。请改用getSize(Point)
。
请参阅http://developer.android.com/reference/android/view/Display.html#getHeight()和http://developer.android.com/reference/android/view/Display.html#getWidth()
试
WindowManager wm = getWindowManager();
Display d = wm.getDefaultDisplay();
Point point = new Point();
d.getSize(point);
if( d.x > d.y ) {
}