我目前在我的手機中運行Kitkat(4.4.2),並且我安裝了一個應用程序。如何在透明狀態欄下顯示內容在Kitkat
在這個應用程序中,狀態欄是透明的,並顯示下面的應用程序的內容。 請參閱圖片。
我應該怎麼做我的程序。
在此先感謝。
我目前在我的手機中運行Kitkat(4.4.2),並且我安裝了一個應用程序。如何在透明狀態欄下顯示內容在Kitkat
在這個應用程序中,狀態欄是透明的,並顯示下面的應用程序的內容。 請參閱圖片。
我應該怎麼做我的程序。
在此先感謝。
由於WarrenFaith建議,http://blog.raffaeu.com/archive/2015/04/11/android-and-the-transparent-status-bar.aspx包含此問題的詳細答案。
您可以使用此庫在kitkat中着色狀態欄顏色。
https://github.com/jgilfelt/SystemBarTint
以下是代碼MainActivity.java
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
w.setFlags(
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
SystemBarTintManager systemBarTintManager = new SystemBarTintManager(this);
systemBarTintManager.setStatusBarTintEnabled(true);
systemBarTintManager.setStatusBarTintColor(Color.parseColor("#689F38"));
}
用於搜索的關鍵詞是: 「Android的透明狀態欄」。第一次打擊:http://blog.raffaeu.com/archive/2015/04/11/android-and-the-transparent-status-bar.aspx我現在要投票結束,因爲這不是一個主題問題所以。請閱讀[常見問題]瞭解更多關於如何提出問題的細節。 – WarrenFaith
感謝WarrenFaith,但是在博客中提到的狀態欄提到了一些陰影。如何處理? –
你應該開始搜索!兩次點擊找到這個:http://stackoverflow.com/questions/21865621/transparent-status-bar-before-4-4-kitkat看到右下方列表標題:「相關」你可以找到很好的相關問題和答案那裏! – WarrenFaith