dz¼±µµ¿ò¸»... |
|
ÄÄÇ»ÅÍ¿Í °ü·ÃÀÖ´Â ¸ðµç ÆÁÀ» °øÀ¯ÇսôÙ.
Chrome Custom Tabs ½ÃÀÛÇϱâ
Chrome Custom TabsÀ» »ç¿ëÇÏ¸é ¾Û¿¡¼ À¥ ȯ°æÀ»º¸´Ù È¿°úÀûÀ¸·Î Á¦¾î ÇÒ ¼ö ÀÖÀ¸¸ç WebView¿¡ ÀÇÁ¸ÇÏÁö ¾Ê°íµµ ±âº» ÄÜÅÙÃ÷¿Í À¥ ÄÜÅÙÃ÷ °£ ÀüȯÀÌ ´õ¿í ¿øÈ° ÇØÁø´Ù. 1. ¸Þ´ºÀÇ Create New Project ¿¡¼ Empty Activity·Î ÇÁ·ÎÁ§Æ®¸¦ ¸¸µç´Ù. 2. build.gradle(Module :app)ÀÇ dependencies¿¡ compile 'com.android.support:customtabs:23.4.0'À» Ãß°¡ÇÑ´Ù. 3. MainActivity ¿¡ ´ÙÀ½À» import¸¦ Ãß°¡ÇÑ´Ù. import androidx.browser.customtabs.CustomTabsIntent; import androidx.core.content.ContextCompat; import android.net.Uri; 4. MainActivity ÀÇ onCreate ÇÔ¼ö¿¡ ´ÙÀ½À» Ãß°¡ÇÑ´Ù. Uri uri = Uri.parse("http://bm.hosoft.kr/"); // create an intent builder CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder(); // Begin customizing // Set toolbar colors intentBuilder.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary)); intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark)); // set start and exit intent CustomTabsIntent customTabsIntent = intentBuilder.build(); // launch the url // customTabsIntent.launchUrl(MainActivity, uri); customTabsIntent.launchUrl(this, uri); 5. ½ÇÇàÇØ º»´Ù. TAG : ChromeCustomTabs½ÃÀÛÇϱ⠾ȵå·ÎÀ̵彺Ʃµð¿À
Custom Tabs ¿¡¼ Á¾·áÇÏ¸é ¸ÞÀξ×ƼºñƼ·Î À̵¿ÇÑ´Ù.
¸ÞÀξ×ƼºñƼ·Î À̵¿ÇÏÁö ¾Ê°í ¹Ù·Î Á¾·áÇÒ·Á¸é MainActivity.java ÀÇ MainActivity Ŭ·¡¼ ¾È¿¡ ´ÙÀ½Äڵ带 »ðÀÔÇÏ¸é ¹Ù·Î Á¾·áµÈ´Ù. @Override protected void onResume() { super.onResume(); finish(); }
ÄÄÆÄÀÏÇÏ¸é °æ°í¹®ÀÌ º¸ÀδÙ.
°æ°í¹®À» ¾Èº¸ÀÌ°Ô ÇÒ·Á¸é 2¹ø ´Ü°è¿¡¼ ´ÙÀ½ÀÇ compile¸¦ implementationÀ¸·Î ¼öÁ¤ÇÏ¸é µÈ´Ù. compile 'com.android.support:customtabs:23.4.0' À» implementation 'com.android.support:customtabs:25.3.0' À¸·Î ¼öÁ¤ÇÑ´Ù.
|
ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ ´ç°¨ 4µ¿ 659-1. ÁÁÀº ¼ÒÇÁÆ®¿þ¾î °³¹ß ¿îµ¿º»ºÎ. ´ëÇ¥ ¾ÈµæÈ£ / sinmungo @ hotmail . com Copyright(c) È£°¡°èºÎ. All Rights Reserved. Since 2003. 04 |