且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-08-12 20:06:54

/**********************************************************************************
 *  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://***.com/questions/5161951/android-only-the-original-thread-that-created-a-view-hierarchy-can-touch-its-vi

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