Faisal Shaikh
Faisal Shaikh

Reputation: 4147

Android: How to create WebView like YouTube has in his app

YouTube app: In about tab of any channel, there are some few Social Networking website links of the channel. I visited some of the links and checked that links open in WebView. Here is the screenshot:

enter image description here

The WebView seems different from normal WebView. Its contain address bar and overflow menu like Chrome.

  1. Are they added EditText for address bar and Overflow menu in WebView activity?

  2. Are they using any library because it's also written `Powered by Chrome?

Upvotes: 1

Views: 2139

Answers (2)

user4617571
user4617571

Reputation:

They use Chrome Custom Tabs

What are Chrome Custom Tabs?

App developers face a choice when a user taps a URL to either launch a browser, or build their own in-app browser using WebViews.

Both options present challenges — launching the browser is a heavy context switch that isn't customizable, while WebViews don't share state with the browser and add maintenance overhead.

Chrome Custom Tabs give apps more control over their web experience, and make transitions between native and web content more seamless without having to resort to a WebView.

Chrome Custom Tabs allow an app to customize how Chrome looks and feels. An app can change things like:

  • Toolbar color
  • Enter and exit animations
  • Add custom actions to the Chrome toolbar, overflow menu and bottom toolbar

It's available in support library :

dependencies {
    ...
    compile 'com.android.support:customtabs:23.3.0'
}

Usage :

String url = ¨https://google.com/¨;
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse(url));

Check more info here

Upvotes: 8

Hicham Bagui
Hicham Bagui

Reputation: 240

it wont be difficult to make it yourself with the functionalities that had but i believe that the webview is based on Chromium (WebView Chromium)

and as you know chrome is token from chromium project

Upvotes: 0

Related Questions