HarmonyOS 组件/容器设置背景样式

是否有自定义xml给控件设置background的方式?

HarmonyOS
2024-10-18 11:15:40
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

代码如下:

//ets文件  
import web_webview from '@ohos.web.webview'  
@Entry  
@Component  
struct BackGroundXml{  
controller: web_webview.WebviewController = new web_webview.WebviewController()  
build() {  
Stack(){  
Column() {  
Text('我是html背景')  
// 通过$rawfile加载本地资源文件。  
Web({ src: $rawfile("index.html"), controller: this.controller })  
}  
Text('我是正文11111111111111111111111111111111111111111111111111111111111111111')  
}  
}  
}
//html文件  
<html>  
<head>  
<style>  
.table-font-size{  
font-size:20px;  
}  
</style>  
</head>  
<body bgcolor=\"white\">  
<table width="1000" border="5" height="1000">  
<tr class="table-font-size">  
<th>Month</th>  
<th>Month</th>  
</tr>  
<tr class="table-font-size">  
<th>Month</th>  
<th>Month</th>  
</tr>  
<tr class="table-font-size">  
<th>Month</th>  
<th>Month</th>  
</tr>  
<tr class="table-font-size">  
<th>Month</th>  
<th>Month</th>  
</tr>  
</table>  
</body>  
</html>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
分享
微博
QQ
微信
回复
2024-10-18 18:37:45
相关问题
HarmonyOS Tabs组件bar背景设置问题
1356浏览 • 1回复 待解决
XComponent组件如何设置背景颜色
3003浏览 • 1回复 待解决
RichEditor组件如何设置初始字体样式
1645浏览 • 1回复 待解决
HarmonyOS Select组件背景色如何设置
603浏览 • 1回复 待解决
Button组件如何设置渐变背景
3762浏览 • 1回复 待解决
HarmonyOS Toast设置样式
576浏览 • 1回复 待解决
取消点击textinput时的背景高亮样式
1214浏览 • 1回复 待解决
设置组件不同状态下的样式
2820浏览 • 1回复 待解决
如何设置组件不同状态下的样式
2669浏览 • 1回复 待解决
文本组件是否支持分段设置字体样式
2851浏览 • 1回复 待解决
HarmonyOS 如何设置控件样式
839浏览 • 1回复 待解决