华为等手机底部带有虚拟按键,会遮挡app的底部,针对这个问题网上有一些解决方案,但都不是很完美,或多或少存在一些问题。
下面推荐一个比较完美的适配方式。
public class AndroidWorkaround { public static void assistActivity(View content) { new AndroidWorkaround(content); } private View mChildOfContent; private int usableHeightPrevious; private ViewGroup.LayoutParams frameLayoutParams; private AndroidWorkaround(View content) { mChildOfContent = content; mChildOfContent.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.O