如何证明android中的webView文本

时间:2017-07-01 19:12:10

标签: android webview

我想在我的应用程序中使用webView,我应该将对齐文本设置为webview

我在下面编写了设置图片大小的代码,但是如何在此代码中添加对齐文字:

private String getHtmlData(String bodyHTML) {
    String head = "<head><style>img{max-width: 100%; width:auto; height: auto;}</style></head>";
    return "<html>" + head + "<body>" + bodyHTML + "</body></html>";
}

将html设置为webview:

            content_newsWebView.loadDataWithBaseURL(null, getHtmlData(response.body().getData().getDescription())
                    , "text/html", "utf-8", null);

如何将对齐文字添加到webView

1 个答案:

答案 0 :(得分:1)

与html相同

public function actionLogin()
{
    if (!Yii::$app->user->isGuest) {
        return $this->goHome();
    }

    $model = new LoginForm();
    if ($model->load(Yii::$app->request->post()) && $model->login()) {
        return $this->goBack();
    }
    return $this->render('login', [
        'model' => $model,
    ]);
}