using SuperScrollView; using UnityEngine; using UnityEngine.UI; public class ReplyItem : MonoBehaviour { public Text mMsgText; public Image mItemBg; public void SetItemData(string str) { mMsgText.text = str; } private void Update() { Vector2 size = mItemBg.GetComponent().sizeDelta; size.x = mMsgText.GetComponent().sizeDelta.x + 20; size.y = mMsgText.GetComponent().sizeDelta.y + 35; mItemBg.GetComponent().sizeDelta = size; } }