I am replaced all tags using from my html for sending as an email in android.
My html is shown here.
<!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>
But is not aligned in the mail.Shown as
##TITLE##
##VALUE##
I am using Html.fromHtml() with the intent. Html.fromHtml() supports <div>. Then what is the problem? How can i solve this?
Thanks
According this blogpost and some source code for that class, it looks like
<style>isn’t a supported tag… but then again<html>,<head>, and<body>aren’t either… so that confuses me a bit.This StackOverflow answer suggests that only basic formatting via HTML is supported, so doing more complex CSS based layout may not work so well. However, as suggested by refhat, inline CSS might work. (You might take a look at the source linked to above, but a brief initial search didn’t return any results for “style”, so you might not even be able to do inline CSS.)
Also, assuming you’re using
Intentto do this… it sounds like not all email applications support HTML, this may be a bad design decision in the long run if the user running the program doesn’t have an email client that supports this.