Google gömülü görünür, böylece uygulamanıza aynı tema stil yerli Chrome uygulamasını başlatmak için izin verir Chrome Custom Tabs yarattı. Buna ek olarak, özel sekmeler, esas olarak web sayfasını önceden getirme ve ön-işleme, ısınma bir web sayfası için bir seçenek sunar. Google, özel sekmeler kullanmanın web sayfalarının neredeyse anında açılmasına izin vereceğini iddia ediyor.
Bu, kullanıcının yalnızca tarayıcıyı başlatan bir bağlantıyı tıklatması durumunda yardımcı olacaktır. Daha hızlı yüklemek için gerçek gömülü bir web görünümü istiyorsanız, bu yardımcı olmayacaktır. O sitede verilen örnek uygulamayı bulmak
DÜZENLEME biraz fazla karmaşık olması. Aşağıda kısa bir uygulama içereceğim. Bu, olası tüm durumları desteklemez, ancak bir başlangıç noktasından yeterli olmalıdır.
Gradle:
dependencies {
compile 'com.android.support:customtabs:23.0.0+'
}
Etkinlik:
public class MainActivity extends AppCompatActivity {
public static final String CUSTOM_TAB_PACKAGE_NAME = "com.android.chrome";
CustomTabsClient mClient;
CustomTabsSession mCustomTabsSession;
CustomTabsServiceConnection mCustomTabsServiceConnection;
CustomTabsIntent customTabsIntent;
static final String URL = "https://www.google.co.za/search?q=test";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
/*
Setup Chrome Custom Tabs
*/
mCustomTabsServiceConnection = new CustomTabsServiceConnection() {
@Override
public void onCustomTabsServiceConnected(ComponentName componentName, CustomTabsClient customTabsClient) {
//Pre-warming
mClient = customTabsClient;
mClient.warmup(0L);
//Initialize a session as soon as possible.
mCustomTabsSession = mClient.newSession(null);
}
@Override
public void onServiceDisconnected(ComponentName name) {
mClient = null;
}
};
CustomTabsClient.bindCustomTabsService(MainActivity.this, CUSTOM_TAB_PACKAGE_NAME, mCustomTabsServiceConnection);
customTabsIntent = new CustomTabsIntent.Builder(mCustomTabsSession)
.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary))
.setShowTitle(true)
.build();
/*
End custom tabs setup
*/
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Launch Chrome Custom Tabs on click
customTabsIntent.launchUrl(MainActivity.this, Uri.parse(URL));
}
});
}
}
Evet yolu vardır sizin Denemesi ve –
gösterebilir. Daha hızlı internet veya daha az malzeme içeren sayfaları yükleyin. –
Web sayfanızı daha az içerik ve javascript ile optimize edin, çünkü bazen javascript'lerin yüklenmesi uzun zaman alır. –