gpt4 book ai didi

Android 应用 iFrame 网站

转载 作者:太空宇宙 更新时间:2023-11-03 11:34:00 24 4
gpt4 key购买 nike

如何在 Android 中创建在 Eclipse 中构建网站的应用程序。它的代码是什么?

提前致谢!

最佳答案

我总是喜欢举个例子,比如this :

首先放入一个xml布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>

</LinearLayout>

然后在 Activity 类中,在 onCreate 中使用它:

@Override protected void onCreate(Bundle savedInstanceState) 
{
super.onCreate(savedInstanceState);
WebView webview;
webview = (WebView) findViewById(R.id.webview);
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("http://www.google.com");
}

关于Android 应用 iFrame 网站,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7697817/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com