Created
September 27, 2019 11:24
-
-
Save yunusemredilber/384ef92e19d7768eac36c14b744695bd to your computer and use it in GitHub Desktop.
Android Translucent Status Bar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.appcompat.app.AppCompatActivity; | |
import android.os.Build; | |
import android.os.Bundle; | |
import android.view.WindowManager; | |
public class MainActivity extends AppCompatActivity { | |
// ----------------------------------------------------------------------- | |
// Activity overrides | |
// ----------------------------------------------------------------------- | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
// Important stuff | |
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){ | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<resources> | |
<!-- Base application theme. --> | |
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar"> | |
<item name="android:windowTranslucentNavigation">true</item> | |
<item name="android:windowTranslucentStatus">true</item> | |
<item name="android:fitsSystemWindows">true</item> | |
</style> | |
</resources> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment