Помогите с SystemBarTint
Помогите с SystemBarTint. Хочу сделать как здесь: https://github.com/jgilfelt/SystemBarTint
Вроде должно работать, но не работает. (вернее работает, но эффекта нет)....Может мой косяк...Гляньте глазком...
public class Cinema4d_page1 extends Fragment {
public final static String TAG = Cinema4d_page1.class.getSimpleName();
private WebView webView;
private TextView text;
public Cinema4d_page1() {
}
public static Cinema4d_page1 newInstance() {
return new Cinema4d_page1();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
webView.saveState(outState);
}
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
webView = (WebView) view.findViewById(R.id.webViewCinema4d1);
webView.setClipToPadding(false);
setInsets(getActivity(),webView);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (savedInstanceState != null) {
webView.restoreState(savedInstanceState);
}
View rootView = inflater.inflate(R.layout.cinema4d_page1_layout, container, false);
text = (TextView) rootView.findViewById(R.id.webtextview1);
ConnectivityManager cn = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo nf = cn.getActiveNetworkInfo();
if (nf != null && nf.isConnected() == true) {
webView = (WebView) rootView.findViewById(R.id.webViewCinema4d1);
WebSettings ws = webView.getSettings();
ws.setSupportZoom(true);
ws.setBuiltInZoomControls(true);
ws.setJavaScriptEnabled(true);
// ws.setDisplayZoomControls(true);
webView.loadUrl("http://*******");
} else {
Toast.makeText(getActivity(), R.string.not_internet_please, Toast.LENGTH_LONG).show();
text.setTypeface(Typeface.createFromAsset(getActivity().getAssets(), "KShYJgLB.ttf"));
text.setText(R.string.not_internet);
}
return rootView;
}
public static void setInsets(Activity context, View view) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return;
SystemBarTintManager tintManager = new SystemBarTintManager(context);
SystemBarTintManager.SystemBarConfig config = tintManager.getConfig();
view.setPadding(0, config.getPixelInsetTop(true), config.getPixelInsetRight(), config.getPixelInsetBottom());
}
}
=======xml=========
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:clipToPadding="false"
android:layout_height="match_parent"
android:background="#ffffff">
<LinearLayout
android:id="@+id/LayoutHome1"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<WebView
android:id="@+id/webViewCinema4d1"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<LinearLayout
android:id="@+id/LayoutHome2"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/webtextview1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:textStyle="bold"
android:gravity="center"
android:textSize="40sp"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
Источник: Stack Overflow на русском