【无标题】按钮字体颜色为白色且使用QStackedWidget,想设置主背景颜色也是白色

按钮字体为白色,按钮背景色为其他颜色,各个页签界面的主背景色想设置为白色,将QStackedWidget背景色直接设置白色即可,设置页签里面的QWidget背景色为白色是不行的,整个按钮都会显示白色,按钮的字都看不见了

QStackedWidget

{

        background-color:rgb(255,255,255);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以通过以下方式来设置AlertDialog标题和内容的字体大小以及按钮字体颜色: 1. 设置标题和内容的字体大小 ```kotlin val dialog = AlertDialog.Builder(context).create() dialog.setTitle("Title") dialog.setMessage("Message") // 设置标题和内容的字体大小 val titleTextView = dialog.findViewById<TextView>(android.R.id.alertTitle) titleTextView?.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18f) val messageTextView = dialog.findViewById<TextView>(android.R.id.message) messageTextView?.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f) dialog.show() ``` 在上面的代码中,我们获取了AlertDialog的标题和内容的TextView,并使用setTextSize()方法来设置它们的字体大小。 2. 设置按钮字体颜色 ```kotlin val dialog = AlertDialog.Builder(context).create() dialog.setTitle("Title") dialog.setMessage("Message") // 设置按钮字体颜色 dialog.setOnShowListener { val positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE) positiveButton.setTextColor(ContextCompat.getColor(context, R.color.colorPrimary)) val negativeButton = dialog.getButton(DialogInterface.BUTTON_NEGATIVE) negativeButton.setTextColor(ContextCompat.getColor(context, R.color.colorAccent)) } dialog.show() ``` 在上面的代码中,我们在AlertDialog显示之后,获取了PositiveButton和NegativeButtonButton对象,并使用setTextColor()方法来设置它们的字体颜色。我们使用ContextCompat.getColor()方法来获取颜色资源的值。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值