Only the original thread that created a view hierarchy can touch its views.

Posted zengjf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Only the original thread that created a view hierarchy can touch its views.相关的知识,希望对你有一定的参考价值。

/**********************************************************************************
 *  Only the original thread that created a view hierarchy can touch its views.
 * 说明:
 *     自定义view的时候出现这个错误,是用错了方法。
 * 
 *                                     2016-6-15 深圳 南山平山村 曽剑锋
 *********************************************************************************/

一、参考文档:
    android “Only the original thread that created a view hierarchy can touch its views.”
        http://stackoverflow.com/questions/5161951/android-only-the-original-thread-that-created-a-view-hierarchy-can-touch-its-vi

二、解决办法
    将线程中调用的 invalidate(); 换成 postInvalidate();

 

以上是关于Only the original thread that created a view hierarchy can touch its views.的主要内容,如果未能解决你的问题,请参考以下文章

Android: Only the original thread that created a view hierarchy can touch its views 异常

andriod 错误:Only the original thread that created a view hierarchy can touch its views——Handler的使用(代码

跨域The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only

跨域The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only

解决The‘Access-Control-Allow-Origin‘ header contains multiple values‘*, ....‘, but only one is allowed

解决The‘Access-Control-Allow-Origin‘ header contains multiple values‘*, ....‘, but only one is allowed