1.Android View未显示时获取其高度(https://blog.csdn.net/u010886975/article/details/53007490)
public int[] unDisplayViewSize(View view) {
int size[] = new int[2];
int width = View.MeasureSpec.makeMeasureSpec(0,
View.MeasureSpec.UNSPECIFIED);
int height = View.MeasureSpec.makeMeasureSpec(0,
View.MeasureSpec.UNSPECIFIED);
view.measure(width, height);
size[0] = view.getMeasuredWidth();
size[1] = view.getMeasuredHeight();
return size;
}
---------------------
作者:云雾雨烟
来源:CSDN
原文:https://blog.csdn.net/u010886975/article/details/53007490
版权声明:本文为博主原创文章,转载请附上博文链接!
2.判断手机是否显示虚拟按键(https://blog.csdn.net/xiaoyu940601/article/details/74606073)
public boolean isNavigationBarShow(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
Display display = getActivity().getWindowManager().getDefaultDisplay();
Point size = new Point();
Point realSize = new Point();
display.getSize(size);
display.getRealSize(realSize);
boolean result = realSize.y!=size.y;
return realSize.y!=size.y;
}else {
boolean menu = ViewConfiguration.get(getActivity()).hasPermanentMenuKey();
boolean back = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
if(menu || back) {
return false;
}else {
return true;
}
}
}
3.屏幕适配(https://blog.csdn.net/u013000152/article/details/80855315 https://blog.csdn.net/qq_35195386/article/details/80801597 ( https://www.jianshu.com/p/4aa23d69d481 autosize) )
4.干货集中营(沉浸式-https://github.com/dongjunkun/GanK)