Skip to content

setContent 导致主线程消息产生大量消息 #82

@mrjoechen

Description

@mrjoechen

#ExpandableTextView.java

   /**
     * 设置内容
     *
     * @param content
     */
    public void setContent(final String content) {
        mContent = content;
        if (isAttached)
            doSetContent();
    }

    /**
     * 实际设置内容的
     */
    private void doSetContent() {
        if (mContent == null) {
            return;
        }
        currentLines = mLimitLines;

        if (mWidth <= 0) {
            if (getWidth() > 0)
                mWidth = getWidth() - getPaddingLeft() - getPaddingRight();
        }

        if (mWidth <= 0) {
            if (retryTime > 10) {
                setText(DEFAULT_CONTENT);
            }
            this.post(new Runnable() {
                @Override
                public void run() {
                    retryTime++;
                    setContent(mContent.toString());
                }
            });
        } else {
            setRealContent(mContent.toString());
        }
    }

没人觉得这段代码有问题么,一直在往主线程抛消息

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions