其他分享
首页 > 其他分享> > Lua弹窗模板

Lua弹窗模板

作者:互联网

Lua弹窗模板

dialog=AlertDialog.Builder(this)

.setTitle("标题").setMessage("消息")
.setPositiveButton("积极",{onClick=function(v) print"点击了积极按钮"end})
.setNeutralButton("中立",nil)
.setNegativeButton("否认",nil)
.show()dialog.create()

--更改消息颜色
message=dialog.findViewById(android.R.id.message)
message.setTextColor(0xff1DA6DD)
--更改Button颜色

import "android.graphics.Color"dialog.getButton(dialog.BUTTON_POSITIVE)
.setTextColor(0xff1DA6DD)dialog.getButton(dialog.BUTTON_NEGATIVE)
.setTextColor(0xff1DA6DD)dialog.getButton(dialog.BUTTON_NEUTRAL)
.setTextColor(0xff1DA6DD)
--更改Title颜色
import "android.text.SpannableString"
import "android.text.style.ForegroundColorSpan"

import 
"android.text.Spannable"
sp = SpannableString("标题")sp
.setSpan(ForegroundColorSpan(0xff1DA6DD),0,#sp,Spannable.SPAN_EXCLUSIVE_INCLUSIVE)dialog
.setTitle(sp)

图片为运行时
觉得有用就点个赞吧

标签:sp,Lua,弹窗,dialog,setTextColor,import,android,0xff1DA6DD,模板
来源: https://blog.csdn.net/qq_58064436/article/details/120242299