As title, normal update not throw an exception
CodePudding user response:
Examples of online all tried, update properly
CodePudding user response:
GetWindowManager method update: no, but I don't have a little the setText textView problem
CodePudding user response:
Is not can be oh, you can look at the source code, the reason why actually can't update the UI in the thread, because when it call requestLayout checkThread method, while the TextView would need in checkForRelayout detect requestLayout, you can try the TextView height set to WRAP_CONTENT, then a large section of the text is set in the thread, can let he level change, a new line will trigger requestLayout method, can lead to collapse at this time
CodePudding user response:
reference only funny reply: 3/f is not can be oh, you can look at the source code, the reason why actually can't update the UI in the thread, because when it call requestLayout checkThread method, while the TextView would need in checkForRelayout detect requestLayout, you can try the TextView height set to WRAP_CONTENT, then a large section of the text is set in the thread, can let he level change, a new line will trigger requestLayout method, will lead to collapse Understand, do not need to measure the size will not check the thread CodePudding user response:
reference only funny reply: 3/f is not can be oh, you can look at the source code, the reason why actually can't update the UI in the thread, because when it call requestLayout checkThread method, while the TextView would need in checkForRelayout detect requestLayout, you can try the TextView height set to WRAP_CONTENT, then a large section of the text is set in the thread, can let he level change, a new line will trigger requestLayout method, will lead to collapse I tried it once, the child thread can invalidate what's going on, and if checkForRelayout judgment does not need requestLayout invalidate will go, but why can't say the child thread invalidate CodePudding user response:
reference 5 floor zhaoqinmuxue reply: Quote: refer to the third floor only funny reply: is not can be oh, you can look at the source code, the reason why actually can't update the UI in the thread, because when it call requestLayout checkThread method, while the TextView would need in checkForRelayout detect requestLayout, you can try the TextView height set to WRAP_CONTENT, then a large section of the text is set in the thread, can let he level change, a new line will trigger requestLayout method, will lead to collapse I tried it once, the child thread can invalidate what's going on, and if checkForRelayout judgment does not need requestLayout invalidate will go, but why can't say the child thread invalidate. To explore the herself, and this is a learning process CodePudding user response:
refer to 6th floor only funny reply: Quote: refer to the fifth floor zhaoqinmuxue reply: Quote: refer to the third floor only funny reply: is not can be oh, you can look at the source code, the reason why actually can't update the UI in the thread, because when it call requestLayout checkThread method, while the TextView would need in checkForRelayout detect requestLayout, you can try the TextView height set to WRAP_CONTENT, then a large section of the text is set in the thread, can let he level change, a new line will trigger requestLayout method, will lead to collapse I tried it once, the child thread can invalidate what's going on, and if checkForRelayout judgment does not need requestLayout invalidate will go, but why can't say the child thread invalidate. Oneself to explore, and this is a learning process Androidstudio source a hidden, debugging is very disgusting, but finally found that the Internet is the view of invalidateInternal invalidateChild method will be called the parent view, and then a do while loop parent view view, looking for his own father constantly, until the call ViewRootImpl. InvalidateChildInParent, will check the current thread here, but I use the millet mobile phone is not the case, in the parent view invalidateChild will check an emblem of hardware acceleration, and then call the parent view onDescantInvalidated, until you reach ViewRootImpl. OnDescntInvalidated to move, and finally found that invalidate and requestLayout besides check threads, are called scheduleTraversals, don't know whose function is to use an acceleration and online said the invocation of the process is not the same