Android fragment UI is frozen in transactions, but works smoothly when restoring the same fragment from the fragment return stack

I have an activity that displays one fragment at a time. There are three different fragments in total. The first fragment and second fragment including recyclerview and thirdfragment have Scrollview

The problem is that when a fragment is attached at runtime, the UI is frozen, but the custom onitemclicklistener listener works normally. When I select any list item of firstfragment, it will be redirected to secondfragment, which is another list view. Secondfragment is also frozen. However, if I use the back button to return, firstfragment can run smoothly. Similarly, When I select the secondfragment list item, I will redirect to the last position, thirdfragment, which is also a rolling view and will be frozen. If I return to the secondfragment, it will start to run smoothly, but if I return to the firstfragment and select any list item again, I will enter the secondfragment UI again to freeze

Note: this problem only occurs on OS version 5.0 (lollipop and later) of 4.2.2 jelly bean, and everything is normal. On Android OS version 5.0, the textinputlayout animation of the support library has the same freezing problem, but it works well on 4.2.2 jelly bean

I created a gist activity with three corresponding fragments, recyclerview. Adapter and custom onitemclicklistener

ProductActivity.java,ProductCategoryFragment.java,ProductListFragment.java,ProductDetailFragment.java,ItemClickSupport.java

Any help will be greatly appreciated. Thank you

edit

When the activity starts, I get the following log

04-01 16:28:47.241 32176-32176/com.example.omkar D/ViewRootImpl: ViewPostImeInputStage ACTION_DOWN
04-01 16:28:47.371 32176-32176/com.example.omkar I/Timeline: Timeline: Activity_launch_request id:com.example.omkar time:77715999
04-01 16:28:47.381 32176-32176/com.example.omkar W/ResourcesManager: getTopLevelResources: com.example.omkar for user  0
04-01 16:28:47.391 32176-32176/com.example.omkar W/ResourcesManager: getTopLevelResources: com.example.omkar for user  0
04-01 16:28:47.401 32176-32176/com.example.omkar D/PhoneWindow: *FMB* installDecor mIsFloating : false
04-01 16:28:47.401 32176-32176/com.example.omkar D/PhoneWindow: *FMB* installDecor flags : -2139029248
04-01 16:28:47.431 32176-32176/com.example.omkar D/Activity: performCreate Call Injection manager
04-01 16:28:47.431 32176-32176/com.example.omkar I/InjectionManager: dispatchOnViewCreated > Target : com.example.omkar.userInterface.activity.product.ProductActivity isFragment :false
04-01 16:28:47.431 32176-32176/com.example.omkar D/DisplayManager: DisplayManager()
04-01 16:28:47.461 32176-32176/com.example.omkar D/PhoneWindow: *FMB* isFloatingMenuEnabled mFloatingMenuBtn : null
04-01 16:28:47.461 32176-32176/com.example.omkar D/PhoneWindow: *FMB* isFloatingMenuEnabled return false
04-01 16:28:47.491 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.501 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.511 32176-32176/com.example.omkar I/InjectionManager: dispatchCreateOptionsMenu :com.example.omkar.userInterface.activity.product.ProductActivity
04-01 16:28:47.511 32176-32176/com.example.omkar I/InjectionManager: dispatchPrepareOptionsMenu :com.example.omkar.userInterface.activity.product.ProductActivity
04-01 16:28:47.531 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.561 32176-32176/com.example.omkar I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@1d12fb86 time:77716194
04-01 16:28:47.921 32176-32176/com.example.omkar W/View: View too large to fit into drawing cache, needs 10563840 bytes, only 3686400 available
04-01 16:28:47.961 32176-32191/com.example.omkar I/art: Background sticky concurrent mark sweep GC freed 32383(1734KB) AllocSpace objects, 7(112KB) LOS objects, 9% free, 16MB/18MB, paused 5.876ms total 38.048ms

resolvent:

The problem has been solved. This is because I mentioned Android: hardwareaccessed = "false" in the androidmanifest.xml file

Answers found: https://stackoverflow.com/a/21145043/4387543

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>