I am trying to display the little debug banner in the top right of the app just like Flutter does but in Android.
What is the best way to implement this? I just want it on this activity.
I am trying to display the little debug banner in the top right of the app just like Flutter does but in Android.
What is the best way to implement this? I just want it on this activity.
Make the app draw behind the status bar by setting the following flags in your theme.
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">@color/transparent</item>
</style>
Use fitsSystemWindows property inside each activity layout xml to determine which content should go behind the statusbar and which content should go below the statusbar. So here in your case, the debug banner should go behind the translucent statusbar. Create the xml file for the activity like that way.
Just use the rotate attribute as shown in the below sample snippet
<View
android:rotation="45"
... />
Use the BuildConfig.DEBUG flag
U can check build is debug mode or release mode using BuildConfig.
if(BuildConfig.DEBUG){
// show banner
}else{
// not show banner
}