2016-07-30 13 views
0

Ich möchte eine Website auf und iPhone anzeigen, aber ich möchte die Statusleiste oben auf der Website transparent angezeigt werden. Rechts zeigt es eine Rinde/schwarze Farbe.Android transluzente Statusleiste Probleme

Ich habe 100 Lösungen online gelesen und ausprobiert und lese so viel Dokumentation wie möglich. Android Status Bar Aber ich kann es immer noch nicht zur Arbeit bringen.

styles.xml

<resources> 

    <!-- Base application theme. --> 
    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar"> 
     <!-- Customize your theme here. --> 
     <item name="colorPrimary">@color/colorPrimary</item> 
     <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
     <item name="colorAccent">@color/colorAccent</item> 

     <item name="android:windowTranslucentNavigation">false</item> 
     <item name="android:windowTranslucentStatus">true</item> 
     <item name="android:statusBarColor">@android:color/transparent</item> 
     <item name="android:navigationBarColor">@android:color/transparent</item> 

     <item name="windowActionModeOverlay">true</item> 
    </style> 

</resources> 

MainActivity.java

public class MainActivity erweitert AppCompatActivity {

private WebView myWebview; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 

    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    myWebview = (WebView) findViewById(R.id.activity_main_webview); 
    WebSettings settings = myWebview.getSettings(); 
    settings.setJavaScriptEnabled(true); 
    myWebview.loadUrl("http://www.google.com"); 
    myWebview.setWebViewClient(new WebViewClient()); 

} 

}

Jede Idee, was könnte ich falsch gemacht?

Antwort

0

Versuchen Sie, "android: windowTranslucentNavigation" zu "true" zu ändern. Und setzen Sie auch FLAG_LAYOUT_NO_LIMITS in Ihrer Aktivität:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { 
      Window w = getWindow(); 
      w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); 
     } 
+1

Vielen Dank für die Hilfe. Das hat mein Problem gelöst. –

Verwandte Themen