I/Choreographer: Skipped 109 frames! The application may be doing too much work on its main thread.

I/Choreographer: Skipped 46 frames! The application may be doing too much work on its main thread.

Log will print something like the one above,

DDMS debugging clocking, looking for a long time, did not find the artificial function caused by the loop call,

However, layout measures such as ConstrainLayout are printed

The reason:

Adjust_resize **SOFT_INPUT_ADJUST_RESIZE** for example, when the soft keyboard is displayed on the second level page, the first level page will be redrawn. If the page is complicated, it is easy to cause stalling.

When your dialog pops up as a second level interface, the covered interface without onPause and if the bottom level interface is an Activity with windowSoftInputMode set, this mode is not ajustNoting, causing the second level interface to repaint

If the level 1 interface is more complex, then you will find that there is a lag, and you will find the print from the log

Solution:

Remove ****windowSoftInputMode from the Activity’s Mainfeast., because it has a default value,

SOFT_INPUT_ADJUST_UNSPECIFIED = 0,

1. You can set this to SOFT_INPUT_ADJUST_NOTHING in ****Mainfeast

2, DialogFragment onResume dynamic setting:

private var mSoftInputMode = -1 override fun onResume() { super.onResume() val window = activity? .window if (window ! = null) { val attrs: WindowManager.LayoutParams? = window.attributes if (attrs ! = null) { mSoftInputMode = attrs.softInputMode window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING) } }} override fun onPause() { super.onPause() if (mSoftInputMode ! = -1) { activity? .window? .setSoftInputMode(mSoftInputMode) }}Copy the code

3, to optimize your level interface, do not nest too much, do not be too complex ~~~~