First, edit the themes. This is an example to use for your Activity in the default styles.xml
:
<style name="Theme.Transparent">
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
and this is the values-v21/styles.xml
version:
<style name="Theme.Transparent">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowAnimationStyle">@null</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
Then in the Activity:
class MyActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
}
super.onCreate(savedInstanceState)
setContentView(R.layout.my_activity)
...
}