Skip to content

Instantly share code, notes, and snippets.

@mohanen
Last active November 19, 2017 10:58
Show Gist options
  • Save mohanen/3ad9fbd040cdeb5863636345b9a46143 to your computer and use it in GitHub Desktop.
Save mohanen/3ad9fbd040cdeb5863636345b9a46143 to your computer and use it in GitHub Desktop.
Transparent Android app - No title bar -
package com.example.ziro.transaparentapp
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.WindowManager
import android.os.Build
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
//copy paste following code in any of your activity file - for java android studio will convert itself during pasting
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // works in kitkat & above
val w = window
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
}
}
}
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Translucent.NoTitleBar"> // use android:Theme.Wallpaper.NoTitleBar for parent if wallpaper is wanted as background
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar" >false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment