一个设置button上字体的封装
来源:互联网 发布:数字软件下载 编辑:程序博客网 时间:2024/05/21 23:00
function funcSetButtonText(btn,text1,color,flag,fontSize,text_position)
-- tolua.cast(btn,"Button")
-- if not flag then
-- if text1 ==language(120) then
-- return
-- end
-- end
local ttf
if btn:getChildByTag(3251) then
btn:removeChildByTag(3251,true)
end
-- ttf = ccui.TextBMFont:create()
-- ttf:setFntFile("Fnt/fnt_01.fnt")
ttf=ccui.Text:create()
ttf:setFontName("FZYHJW--GB1-0.ttf")
ttf:setFontSize(fontSize and fontSize or 20)
ttf:enableOutline(cc.c3b(0,0,0),2)
if text_position then
ttf:setPosition(text_position)
else
ttf:setPosition(cc.p( btn:getVirtualRendererSize().width/2, btn:getVirtualRendererSize().height/2))
end
btn:addChild(ttf,20)
ttf:setString(text1)
if color then
ttf:setColor(color)
else
ttf:setColor(cc.c3b(254,251,104))
end
ttf:setTag(3251)
ttf:stopAllActions()
btn:setPressedActionEnabled(false)
return ttf
end
-- tolua.cast(btn,"Button")
-- if not flag then
-- if text1 ==language(120) then
-- return
-- end
-- end
local ttf
if btn:getChildByTag(3251) then
btn:removeChildByTag(3251,true)
end
-- ttf = ccui.TextBMFont:create()
-- ttf:setFntFile("Fnt/fnt_01.fnt")
ttf=ccui.Text:create()
ttf:setFontName("FZYHJW--GB1-0.ttf")
ttf:setFontSize(fontSize and fontSize or 20)
ttf:enableOutline(cc.c3b(0,0,0),2)
if text_position then
ttf:setPosition(text_position)
else
ttf:setPosition(cc.p( btn:getVirtualRendererSize().width/2, btn:getVirtualRendererSize().height/2))
end
btn:addChild(ttf,20)
ttf:setString(text1)
if color then
ttf:setColor(color)
else
ttf:setColor(cc.c3b(254,251,104))
end
ttf:setTag(3251)
ttf:stopAllActions()
btn:setPressedActionEnabled(false)
return ttf
end
0 0
- 一个设置button上字体的封装
- Android--在一个Button上显示不同类型的字体
- 设置Button的字体颜色状态选择器
- 怎样在一个控件上设置字体局部的效果
- 修改button上字体样式
- android Button字体设置颜色
- 设置button按钮背景色,及字体的颜色
- 做一个萌萌哒的button之图标字体
- 【Android】如何设置一个自定义的Button
- button上设置图片
- 设置一个Label控件上文字的字体样式和字体大小随机的代码.
- 设置一个Label控件上文字的字体样式和字体大小随机的代码
- Android之自定义背景Button按钮、自定义形状Button的全攻略、设置字体颜色
- 封装一个Button的角标类(Image等同理可以实现)
- iOS开发造轮子 | 优雅的封装一个倒计时button
- 设置UIButton上字体的颜色
- 设置UIButton上字体的对齐方式
- 设置UIButton上字体的对齐方式
- css3中单位px,em,rem,vh,vw,vmin,vmax的区别及浏览器支持情况
- Easyui如何获取一行当中的某个数据
- 快速清理Android中无用的资源信息,图片,字符串等
- 面向对象之名词解释
- IE下兼容CSS3属性(或IE兼容box-shadow)方法
- 一个设置button上字体的封装
- addTextChangedListener(文本监听)参数解释及实现EditText字数监听
- TortoiseSVN安装正常,完成后bin目录下没有svn.exe
- Github使用教程
- linux下 nginx+nginx_upload_module+GraphicsMagick 上传并压缩照片(java)
- Elasticsearch 查询使用
- 建议65:总是处理未捕获的异常
- 一分钟实现动态模糊效果(毛玻璃)
- 数组的地址