我使用我的html 替换了所有标签,以便在 android 中作为电子邮件发送。我的 html 显示在这里。
<!DOCTYPE html>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Title</title>
<style>
body {
background: #FFFFFF;
margin: auto;
font-family: Helvetica;
color: #808080;
}
a {
color: #3A41A1;
}
#wrapper {
width: 537px;
margin: auto;
}
#header {
width: 100%;
color: #000000;
margin-bottom: 15px;
}
#content {
width: 100%;
background: #DAFFF5;
margin-top: 10px;
border-collapse: collapse;
font-size: 14px;
display: table;
}
.row {
display: table-row;
padding: 8px;
border: 1px solid black;
}
.cell-header {
padding: 8px;
display: table-cell;
}
.cell-left {
display: table-cell;
padding: 8px;
border: 1px solid black;
color: #006BF2;
width: 90px;
}
.cell-right {
display: table-cell;
padding: 8px;
border: 1px solid black;
color: #000000;
text-align: left;
}
</style>
</head>
<body>
<div id="wrapper">
<div id="header">
##HEADER## <a href="#">##TEXT1##</a>, <a href="#">##TEXT2##</a>, <a href="#">##TEXT3##</a>
</div>
<div id="content">
<div class="row">
<div class="cell-header" style="color:#FF6A00; font-weight:bold; text-transform:capitalize; text-align: left;">##NAME##</div>
<div class="cell-header" style="text-align: right;"><a href="#" style="color:#006BF2;">##LINK##</a></div>
</div>
<div class="row">
<div class="cell-left">
##TITLE##
</div>
<div class="cell-right">
##VALUE##
</div>
</div>
<div class="row">
<div class="cell-left">
##TITLE##
</div>
<div class="cell-right">
##VALUE##
</div>
</div>
<div class="row">
<div class="cell-left">
##TITLE##
</div>
<div class="cell-right">
##VALUE##
</div>
</div>
</div>
</div></body></html>
但是在邮件中没有对齐。显示为
##TITLE##
##VALUE##
我有意使用 Html.fromHtml() 。Html.fromHtml() 支持<div>
. 那么问题是什么?我该如何解决这个问题?
谢谢