Last active
November 19, 2017 10:58
-
-
Save mohanen/3ad9fbd040cdeb5863636345b9a46143 to your computer and use it in GitHub Desktop.
Transparent Android app - No title bar -
This file contains hidden or 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
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) | |
} | |
} | |
} |
This file contains hidden or 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="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