HarmonyOS 粘贴控件设置透明颜色显示黑色

PasteButton({icon:null, text:PasteDescription.PASTE, buttonType:ButtonType.Capsule})
  • 1.

.backgroundColor(Color.Transparent)

设置透明背景颜色,显示黑色,效果参见截图

HarmonyOS 粘贴控件设置透明颜色显示黑色 -鸿蒙开发者社区

HarmonyOS
2025-01-10 09:27:43
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
FengTianYa

出于安全考虑,现在不支持设置透明。

如果之前是透明的设置,系统会强制设置成非透明的,需要重新适配背景色,透明度不低于10%

@Entry
@Component
struct index2 {
  build() {
    Column() {
      SaveButton({ icon: SaveIconStyle.FULL_FILLED })
        .iconColor(Color.Red)
        .backgroundColor(Color.Transparent)//不写是蓝色背景,写上是黑色背景。
        .backgroundColor('#33fffefe')
          //todo 设置按钮背景色不透明度 10%

        .iconSize(120)
        .width(200)
        .height(200)
    }
    .width('100%')
    .height('100%')
    .justifyContent(FlexAlign.Center)
    .backgroundColor(Color.Blue) //加背景后验证上面设置的SaveButton背景非透明
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
分享
微博
QQ
微信
回复
2025-01-10 12:15:05


相关问题
HarmonyOS 如何设置颜色透明
1370浏览 • 1回复 待解决
如何将背景颜色设置透明
3179浏览 • 1回复 待解决
HarmonyOS 有没有设置颜色透明度的方法
1233浏览 • 1回复 待解决
HarmonyOS color颜色怎么指定透明度?
1348浏览 • 1回复 待解决
HarmonyOS 如何获取和设置粘贴
769浏览 • 1回复 待解决
HarmonyOS UIAbility如何设置透明背景
464浏览 • 1回复 待解决
自定义颜色透明度如何实现?
731浏览 • 1回复 待解决