android是否提供HTML支持

时间:2014-01-02 05:09:21

标签: android

android是否提供任何字段名称属性 或类似于HTML 中的表单名称属性,以便可以在下一页使用这些属性名称使用HTML完成?

3 个答案:

答案 0 :(得分:0)

当然是的。如果我理解你的问题是正确的,那么你就会在表单中询问字段名称或者你在应用程序中拥有的任何内容,就像在HTML中我们添加name =“”和id =“”等一样,对吧?

如果那是问题,那么Android支持这种属性到Activity中的每个实体。

例如:

    <TextView android:id="@+id/My_TextView_ID/NAME_here"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="I am a TextView" />
    <Button android:id="@+id/My_Button_ID/NAME_here"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="I am a Button" />

现在您可以在任何您想要的活动中使用它。希望这可以帮助。好吧查了一下。

答案 1 :(得分:0)

您可以使用:

Html.formatHtml(your html code);

如果你想在textview中显示html,只需使用:

textview.setText(Html.formatHtml(your html code));

答案 2 :(得分:-2)

查看此链接,这将有助于您link

您可以像这样添加javascript界面​​

  

您可以在Android应用程序中包含以下类:

public class WebAppInterface {
     Context mContext;

/** Instantiate the interface and set the context */
WebAppInterface(Context c) {
    mContext = c;
}

/** Show a toast from the web page */
   @JavascriptInterface
     public void showToast(String toast) {
    Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
    }
}
  

将此javascript界面​​添加到webview

WebView webView = (WebView) findViewById(R.id.webview);
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
  

从html输入标签

调用iterface
  <input type="button" value="Say hello" onClick="showAndroidToast('Hello Android!')" />

 <script type="text/javascript">
    function showAndroidToast(toast) {
    Android.showToast(toast);
  }

相关问题