I want to create my own library, which contains common functionality flow. So that it can used in multiple apps at runtime, by just importing my library.
I am following Android developer guide and some examples to create library.
I am defining theme for my library is Theme.AppCompat.Light.NoActionBar
.
Application using my library having defined theme is Theme.AppCompat.Light.DarkActionBar
.
So my problem is: when user call action to open my library, library should open without action bar, but it open below the Application action bar/toolbar.
I am adding image, which will describe my actual problem:
Is there any setting which will help me to open my library with my defined theme?
You can use below the onCreate.
getSupportActionBar().hide()
In styles.xml similar to this:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
Note:- Need to add below condition, in case of library. Because some application might already have NoActionBar theme.
if (getSupportActionBar() != null) {
getSupportActionBar().hide();
}