[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Embedding web content into your app as primary or supporting content\n\nAndroid allows you as a developer to build on the power of the web within your\nnative application, so you can benefit from the flexibility and efficiency of\ndisplaying certain types of content.\n\nEmbedding content using WebView\n-------------------------------\n\nThe [WebView](/reference/android/webkit/WebView) API gives developers\naccess to the capabilities of a mini-browser for displaying web content within\nyour application. This lets you provide web-powered experiences as a core\nor supporting part within your application, as seen in **Figure 1**.\n**Figure 1.** Web content embedded within the app with WebViews as primary (left) and supporting content (right).\n\nWhat can WebView do?\n--------------------\n\nThis is what you can do with WebView in your application:\n\n**Embed web**: A WebView is integrated into an app's user interface as a\ncomponent, much like a button or text field.\n\n**Load content**: WebView can load web content from various sources:\n\n- Remote URLs: It can fetch and display web pages from the internet, just like a regular browser.\n- Local files: It can load HTML, CSS, and JavaScript files stored within the app's resources.\n- Dynamically generated content: The app can generate HTML content on-the-fly and feed it to the WebView.\n\n**Render**: WebView uses its browser engine to parse and render the HTML,\nCSS, and JavaScript, displaying the resulting web page within its designated\narea in the app's UI.\n\n**Execute JavaScript**: WebView can execute JavaScript code within the\ncontext of the loaded web page. This allows for dynamic interactions and\nupdates within WebView.\n\n**Native app interaction**: This is where WebView gets more powerful. It allows\nfor bidirectional communication between the web page and the app.\n\n- JavaScript to native: JavaScript code running in WebView can call host APIs of the app, enabling access to device features like camera, GPS, or sensors.\n- Native to JavaScript: The app can also inject JavaScript code into WebView, manipulate the web page's content, or respond to events triggered by the web page.\n\nHow is WebView different from a typical browser like Chrome?\n------------------------------------------------------------\n\nWebView is a highly custom component which provides the core functionality of a\nwindow into the web. Unlike a browser, which provides much of the navigation bar\nand other user needs to navigate the web more broadly, the overall experience of\nWebView is shaped by your app's design and purpose.\n\nTo better understand how WebView differs from standard browsers, see the\nfollowing explanations:\n\n**UI**: WebView is used for displaying web content, and does not have its own\nheader or UI like most other common browsers (home button, URL bar, navigation,\nsettings, etc.)\n\n**Features**: Many browsers have built additional features to augment the\nbrowsing experience such as bookmarks, permissions, or history.\n\n**Updates**: Because Android WebView is a system service on Android, updates are\npushed and integrated into the apps automatically on a monthly basis. Browsers\nrely on their corresponding app updates and then for end users to apply the\nupdate on their devices.\n\nWhere to start?\n---------------\n\nFor information on how to use WebView in your app, see the article\n[Build web apps in WebView](/guide/webapps/webview).\n\n### Additional resources\n\nTo develop web pages for Android-powered devices using WebView objects or Custom\nTabs, see the following documents:\n\n- [Build web apps in WebView](/guide/webapps/webview)\n- [Manage WebView objects](/guide/webapps/managing-webview)\n- [Support different screens in web apps](/guide/webapps/targeting)\n- [Debug web apps](/guide/webapps/debugging)\n- [Best practices for web apps](/guide/webapps/best-practices)\n- [Opt-in to WebView Beta](https://play.google.com/apps/testing/com.google.android.webview)\n- [In-app browsing using Embedded Web](/develop/ui/views/layout/webapps/in-app-browsing-embedded-web)\n- [Overview of Android Custom Tabs](/develop/ui/views/layout/webapps/overview-of-android-custom-tabs)"]]