Web içeriğini birincil veya destekleyici içerik olarak uygulamanıza yerleştirme
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Android, uygulamanızda web'in gücünden yararlanmanızı sağlar. Böylece, belirli içerik türlerini göstermenin esnekliğinden ve verimliliğinden yararlanabilirsiniz.
WebView kullanarak içerik yerleştirme
WebView API, uygulamanızda web içeriği görüntülemek için mini tarayıcı özelliklerine erişmenizi sağlar. Bu sayede, Şekil 1'de gösterildiği gibi, uygulamanızda temel veya destekleyici bir bölüm olarak web destekli deneyimler sunabilirsiniz.
1.Şekil Birincil (sol) ve destekleyici içerik (sağ) olarak `WebView` nesneleriyle uygulamaya yerleştirilmiş web içeriği.
WebView ile yapabilecekleriniz
Uygulamanızda WebView ile şunları yapabilirsiniz:
Web'i yerleştirme: WebView, bir uygulamanın kullanıcı arayüzüne düğme veya metin alanı gibi bir bileşen olarak entegre edilir.
İçerik yükleme: WebView, çeşitli kaynaklardan web içeriği yükleyebilir:
Uzak URL'ler: Normal bir tarayıcı gibi internetteki web sayfalarını getirebilir ve görüntüleyebilir.
Yerel dosyalar: Uygulamanın kaynaklarında depolanan HTML, CSS ve JavaScript dosyalarını yükleyebilir.
Dinamik olarak oluşturulan içerik: Uygulama, HTML içeriğini dinamik olarak oluşturup WebView'ya sağlayabilir.
Oluşturma: WebView, HTML, CSS ve JavaScript'i ayrıştırıp oluşturmak için tarayıcı motorunu kullanır ve sonuçtaki web sayfasını uygulamanın kullanıcı arayüzündeki belirlenmiş alanında gösterir.
JavaScript'i yürüt: WebView, yüklenen web sayfası bağlamında JavaScript kodunu yürütebilir. Bu sayede WebView içinde dinamik etkileşimler ve güncellemeler yapılabilir.
Uygulamanızla etkileşim kurma: WebView daha da güçlü hale gelir. Web sayfası ile uygulama arasında iki yönlü iletişimi sağlar.
JavaScript'ten uygulama koduna: WebView içinde çalışan JavaScript kodu, uygulamanın ana makine API'lerini çağırabilir. Bu sayede kamera, GPS veya sensörler gibi cihaz özelliklerine erişim sağlanır.
JavaScript'e uygulama kodu: Uygulama, WebView öğesine JavaScript kodu da ekleyebilir, web sayfasının içeriğini değiştirebilir veya web sayfası tarafından tetiklenen etkinliklere yanıt verebilir.
WebView ile tarayıcı arasındaki farklar
WebView, web'e açılan bir pencerenin temel işlevini sağlayan, son derece özelleştirilmiş bir bileşendir. Web'de daha geniş kapsamlı gezinmek için gezinme çubuğu ve diğer kullanıcı arayüzü öğelerini sağlayan bir tarayıcının aksine, WebView genel deneyimi uygulamanızın tasarımı ve amacı tarafından şekillendirilir.
WebView ile standart tarayıcılar arasındaki farkı daha iyi anlamak için aşağıdaki açıklamaları inceleyin:
Kullanıcı arayüzü: WebView, web içeriğini görüntülemek için kullanılır ve çoğu yaygın tarayıcıda olduğu gibi kendi başlığı veya kullanıcı arayüzü (ör. ana sayfa düğmesi, adres çubuğu ya da ayarlar menüsü) yoktur.
Özellikler: Birçok tarayıcıda, göz atma deneyimini geliştirmek için yerleşik özellikler (ör. yer işaretleri, izinler veya geçmiş) bulunur.
Güncellemeler: Android WebView, Android'de bir sistem hizmeti olduğundan güncellemeler aylık olarak otomatik şekilde uygulamalara gönderilir ve entegre edilir.
Tarayıcılar, ilgili uygulama güncellemelerine ve ardından son kullanıcıların cihazlarında güncellemeyi uygulamasına bağlıdır.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-09-03 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-09-03 UTC."],[],[],null,["Android lets you build on the power of the web within your app. So, you can\nbenefit from the flexibility and efficiency of displaying certain types of\ncontent.\n\nEmbedding content using `WebView`\n\nThe [`WebView`](/reference/android/webkit/WebView) API gives you access to the capabilities of a mini-browser\nfor displaying web content within your app. This lets you provide web-powered\nexperiences as a core or supporting part within your app, as seen in **Figure\n1**.\n**Figure 1.** Web content embedded within the app with \\`WebView\\` objects as primary (left) and supporting content (right).\n\nWhat `WebView` can do\n\nYou can do the following with `WebView` in your app:\n\n- **Embed web** : A `WebView` is integrated into an app's user interface as a\n component, 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 dynamically and provide it to the `WebView`.\n- **Render** : `WebView` uses its browser engine to parse and render the HTML,\n CSS, and JavaScript, displaying the resulting web page within its designated\n area in the app's UI.\n\n- **Execute JavaScript** : `WebView` can execute JavaScript code within the\n context of the loaded web page. This allows for dynamic interactions and\n updates within the `WebView`.\n\n- **Interact with your app** : This is where `WebView` gets more powerful. It\n enables bidirectional communication between the web page and the app.\n\n - **JavaScript to app code** : JavaScript code running in a `WebView` can call\n host APIs of the app, enabling access to device features like camera, GPS,\n or sensors.\n\n - **App code to JavaScript** : The app can also inject JavaScript code into a\n `WebView`, manipulate the web page's content, or respond to events triggered\n by the web page.\n\nHow `WebView` differs from a browser\n\nA `WebView` is a highly custom component that provides the core functionality of\na window into the web. Unlike a browser, which provides a navigation bar and\nother user interface elements to navigate the web more broadly, the overall\nexperience of a `WebView` 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** : A `WebView` is used for displaying web content and doesn't have its own\nheader or UI like most other common browsers, for example, a home button,\naddress bar, or settings menu.\n\n**Features**: Many browsers have built-in 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\nare pushed and integrated into the apps automatically on a monthly basis.\nBrowsers rely on their corresponding app updates and then for end users to apply\nthe update on their devices.\n\nGet started\n\nFor information on how to use `WebView` in your app, see the document\n[Build web apps in `WebView`](/guide/webapps/webview).\n\nAdditional resources\n\nTo develop web pages for Android-powered devices using `WebView` objects or\nCustom Tabs, 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)"]]