发帖
充值
 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
0 0

动态UI 控件之间的空隙 不能自定义吗?

问答专区 15821 0 2021-9-20 16:03:53
本帖最后由 yideng 于 2021-9-20 16:09 编辑
  1. -- ================== 多选框 =======================
  2. local checkBoxClass = class("CheckBox", viewClass)

  3. function checkBoxClass:ctor(text, id)
  4.     self._id = id or self.__cname .. getViewID()
  5.     self._text = text or "单选框"
  6.     self._check = false
  7.     self._w = -2
  8.     self._h = -2
  9.     self._pd = {1,1,1,1}
  10.     self._textSize = 12
  11. end

  12. --- 设置是否勾选
  13. --- @param check boolean 默认false
  14. function checkBoxClass:check(check)
  15.     self._check = check
  16.     if self.isCreated then
  17.         ui.setCheckBox(self._id, self._text, self._check, self._w, self._h)
  18.     end
  19.     return self
  20. end

  21. function CheckBox(text, id)
  22.     return checkBoxClass.new(text, id)
  23. end
复制代码
设置了1,1,1,1 不好使呢。
  1. -- 设置内边距
  2. function viewClass:pd(l, t, r, b)
  3.     self._pd = { l, t, r, b }
  4.     if self.isCreated then
  5.         ui.setPadding(self._id, l, t, r, b)
  6.     end
  7.     return self
  8. end
复制代码


使用道具 举报

您需要登录后才可以回帖 立即登录
高级模式
返回
问答专区