Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.nama.paket.apkmu;
- import android.annotation.SuppressLint;
- import android.content.Context;
- import android.content.res.Configuration;
- import android.os.Build;
- import android.util.AttributeSet;
- import android.webkit.WebView;
- public class LollipopFixedWebView extends WebView {
- public LollipopFixedWebView(Context context) {
- super(getFixedContext(context));
- }
- public LollipopFixedWebView(Context context, AttributeSet attrs) {
- super(getFixedContext(context), attrs);
- }
- public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
- super(getFixedContext(context), attrs, defStyleAttr);
- }
- @SuppressLint("NewApi")
- private static Context getFixedContext(Context context) {
- if (Build.VERSION.SDK_INT == 21 || Build.VERSION.SDK_INT == 22) // Android Lollipop 5.0 & 5.1
- return context.createConfigurationContext(new Configuration());
- return context;
- }
- }
- /*
- // letakkan di layout sesuaikan nama paketnya
- <com.nama.paket.apkmu.LollipopFixedWebView
- android:id="@+id/webview"
- android:layout_width="match_parent"
- android:layout_height="match_parent"/>
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement