问题
I am sending a mail using intent from android application but my css is not loading. can someone help me load the css please. where am i wrong. Am stuck on this silly option for hours nows.
here part of my div.
<div style="background:"+String.format(hex,colors.get(position).hex)"></div>...
回答1:
I had the same problem, and couldnt fix it. I don't think its possible to send css with the default email clients (correct me if i'm wrong).
My work around was sending the html as a attachment.
see: Is it possible to send html with the mail intent?
Edit: here is example how i did it:
- save the html as a file..
- add you attachments to a list of Uri objects
see following code how to create a mail intent with the attachements..
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); emailIntent.setType("text/html"); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "title"); emailIntent.putExtra(Intent.EXTRA_TEXT, "email body text"); emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); startActivity(Intent.createChooser(emailIntent, "Email:"));
来源:https://stackoverflow.com/questions/13644486/android-sending-email-with-css-html-embedded