聊天富文本<input = button>显示异常


1.png


2.png

 
 
会出现重叠 原来button为三个字 超过三个字item就不会自动匹配
3.png

 
button是已经做了关联了  button里的text设为宽度和高度   还有列表里每个item的富文本也是自动大小设为高度了
请问这是为什么呢?还有颜色也是要重新刷新一次才出现
 
 
最后附上代码
首先self.com_send_list_chat:RemoveChildrenToPool()
然后循环里面:
item = self.com_send_list_chat:AddItemFromPool(self.my_word_item_url)
                local title = item:GetChild("title_02")
                title.text = message.msg
                local count = title.asRichTextField.richTextField.htmlElementCount
                for i=0,count-1 do
                    local element = title.asRichTextField.richTextField:GetHtmlElementAt(i)
                    if element.htmlObject and element.htmlObject:GetType() == typeof(FairyGUI.Utils.HtmlButton) then
                        if element:Get("color") then
                            element.htmlObject.button:GetChild("title").text = string.format("[color=%s]%s[/color]",element:Get("color"),element:Get("value"))
                        end
                        element.htmlObject.displayObject.onClick:Set(
                            function ()
                                self:OnClickHtmlButton(element)
                            end
                        )
                    end
                end
                title.width = title.textWidth

4.png

 
 
已邀请:

谷主

赞同来自:

input button不支持动态大小的。你改了大小文本也不会重新布局。
 
你这个需求完全不需要什么input button,也不应该用。再看看Emoji这个demo。

要回复问题请先登录注册