开发者

postInvalidate() is working slow?

开发者 https://www.devze.com 2022-12-17 03:48 出处:网络
I am using LinearLayout implemented in order to paint polygon on it. But my implemented dispatchDraw(Canvas canvas) method is working very slow.

I am using LinearLayout implemented in order to paint polygon on it. But my implemented dispatchDraw(Canvas canvas) method is working very slow.

Approximately, one draw cycle finish in 535ms (milliseconds).

To call myLinearLayout.postInvalidate() from non UI thread, using following code :

myActivity.runOnUiThread(new Runnable() {
    public void run() {
             myLinearLayout.postInvalidate();
      开发者_如何学运维  }
});

Is there a way to increase drawing speed ?

Please suggest.

Thanks in advance.


The postInvalidate() is designed to use to invalidate the View from a non-UI thread. You don't have to call with the runOnUiThread again.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号