Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/228.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android html标记<;部门>;字符串中的webview_Android_Html_Webview - Fatal编程技术网

Android html标记<;部门>;字符串中的webview

Android html标记<;部门>;字符串中的webview,android,html,webview,Android,Html,Webview,我的活动包括长文本视图必须用水平彩色线(分隔符)分隔为多个段落,我使用webview允许添加: <div html tag 尝试在字符串中使用param='value'而不是param=“value” 像这样: String customHtml = "<body><h1>Heading Text</h1><p>This is example " + "<strong>HTM

我的活动包括长文本视图必须用水平彩色线(分隔符)分隔为多个段落,我使用webview允许添加:

 <div html tag 

尝试在字符串中使用param='value'而不是param=“value”

像这样:

String customHtml = "<body><h1>Heading Text</h1><p>This is example  " +
                        "<strong>HTML </strong>tag in webviw .&nbsp;</p>" +   
                        "<div class='aligncenter' style='width:400px;height:0;
                           border-top:2px solid #FF7500;font-size:0;'></div>" ;
String customHtml=“Heading Text这是一个示例”+
“HTMLwebviw中的标记。

”+ "" ;

顺便说一句,你是否在css中设置了aligncenter类?

我亲爱的朋友,我是android开发的新手,我的目标是在段落中设置长文本视图,中间带有彩色分隔符,还可以自定义每个段落中的文本,比如为每个段落添加自定义字体,不同颜色的文本,这意味着能够完全定制我的文本视图,我搜索了很多网络,并寻找在资产文件夹中创建html和css的例子,但我不能成功创建,然后从我的类调用它,如果你真的帮助我,我将感谢你的帮助efforts@androidqq6嗯,所以我写的方式都不管用?我还没有开发安卓系统,但我想尽快开发,我已经处理html+css好几年了,所以我想尝试帮助你。如果你告诉我们整个html部分是否没有显示或只有分隔符不存在,那会有帮助。它工作,但“aligncenter”不工作现在我有行,但其他定制我无法获得,非常感谢,但如果你能帮助我与其他工作人员合作,我将不胜感激,谢谢如果你的CSS文件中没有任何名为aligncenter的类,那么就不应该这样,如果你想让它与中心对齐,试着把它放在你的style='text-align:center;。。。其他的东西…“或者有时候你需要在它周围放置另一个div,这样div内的东西(在本例中是你的线)就会与中心对齐。
private WebView webView;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webview);

    webView = (WebView) findViewById(R.id.webView1);

    String customHtml = "<body><h1>Heading Text</h1><p>This is example  " +
                        "<strong>HTML </strong>tag in webviw .&nbsp;</p>" +   
                        "<div class="aligncenter" style="width:400px;height:0;
                           border-top:2px solid #FF7500;font-size:0;"></div>" ;

           webView.loadData(customHtml, "text/html", "UTF-8");}
    String customHtml = "<body><h1>Heading Text</h1><p>This is example  " +
                        "<strong>HTML </strong>tag in webviw .&nbsp;</p>" +   
                        "<div class=aligncenter style=width:400px;height:0;border-
                         top:2px solid #FF7500;font-size:0;></div>" ;

           webView.loadData(customHtml, "text/html", "UTF-8");}
                                              }            
String customHtml = "<body><h1>Heading Text</h1><p>This is example  " +
                        "<strong>HTML </strong>tag in webviw .&nbsp;</p>" +   
                        "<div class='aligncenter' style='width:400px;height:0;
                           border-top:2px solid #FF7500;font-size:0;'></div>" ;