Android - "setToolbarColor (int)" और "setSondondaryToolbarColor (int)" को हटा दिया गया है
Dec 13 2020
मैं इस कोड का उपयोग क्रोम कस्टम टैब के साथ लिंक खोलने के लिए करता हूं। लेकिन यह और के @Deprecated
लिए दिखा रहा है । मुझे प्रतिस्थापन के लिए कुछ भी नहीं मिला है।setToolbarColor()
setSecondaryToolbarColor()
नोट: Android स्टूडियो सुझाव देता है कि "setDefaultColorSchemeParams का उपयोग करें।" लेकिन इसका कोई उदाहरण नहीं मिला है।
Uri uri = Uri.parse(url);
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
intentBuilder.setToolbarColor(ContextCompat.getColor(activity,R.color.background));
intentBuilder.setSecondaryToolbarColor(ContextCompat.getColor(activity,R.color.background));
intentBuilder.setStartAnimations(activity,R.anim.slide_in_right,R.anim.slide_out_left);
intentBuilder.setExitAnimations(activity,android.R.anim.slide_in_left,android.R.anim.slide_out_right);
CustomTabsIntent customTabsIntent = intentBuilder.build();
customTabsIntent.launchUrl(activity,uri);
जवाब
5 MLFR2kx Dec 13 2020 at 20:13
CustomTabColorSchemeParams
इसके बजाय उपयोग करें : संदर्भ
Uri uri = Uri.parse(url);
CustomTabsIntent.Builder intentBuilder = new CustomTabsIntent.Builder();
CustomTabColorSchemeParams params = new CustomTabColorSchemeParams.Builder()
.setNavigationBarColor(ContextCompat.getColor(activity,R.color.background))
.setToolbarColor(ContextCompat.getColor(activity,R.color.background))
.setSecondaryToolbarColor(ContextCompat.getColor(activity,R.color.background))
.build();
intentBuilder.setColorSchemeParams(CustomTabsIntent.COLOR_SCHEME_DARK, params);
intentBuilder.setStartAnimations(activity, R.anim.slide_in_right,R.anim.slide_out_left);
intentBuilder.setExitAnimations(activity,android.R.anim.slide_in_left,android.R.anim.slide_out_right);
CustomTabsIntent customTabsIntent = intentBuilder.build();
customTabsIntent.launchUrl(activity,uri);