1、
java.lang.Illegalstateexception only fullscreen opaque activities can request orientation
Android8.0系统,activity设置了orientation,再在style中设置<item name="android:windowIsTranslucent">true</item>会报该错误,将android:windowIsTranslucent设置为false即可。
2、oppo手机6.0以上系统不支持instant run,需要关闭才能调试。
3、在项目中使用Litepal数据库时,两个异步线程(一个Litepal产生的异步线程,一个项目中的异步线程)同时操作一个类出现ANR;
在应用的Application类中,采取了预先在主线程中将数据库相关类全部初始化的方式:
Class c1 = Class.forName("AnnouncementInfo");
Class c2 = Class.forName("......");
......
参考:类初始化造成的死锁
4、PopupWindow在android7.0手机上,高度设置为match_parent,会占满全屏。
解决方案:重写showAsDropDown方法;
@Override
public void showAsDropDown(View anchor) {
if (Build.VERSION.SDK_INT >= 24) {
Rect visibleFrame = new Rect();
anchor.getGlobalVisibleRect(visibleFrame);
int height = anchor.getResources().getDisplayMetrics().heightPixels - visibleFrame.bottom;
setHeight(height);
}
super.showAsDropDown(anchor);
}
5、禁止app被截屏,activity中设置
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
6、关于ScrollView里面包裹LinearLayout 设置权重 填充满屏幕无效问题解决方法。
当ScrollView里的元素想填满ScrollView时,使用"fill_parent"是不管用的,必需为ScrollView设置:android:fillViewport="true"。
网友评论