Android Code Snippet No Action Bar on Appcompat Apps (app launching animation)

Hi:

I want to share this B4A configuration, usefull when you have to code an app that needs appcompat library (for example, NumberMorphView from Johan Schoeman) but you don't need the action bar and don't want to appear on app launching windows (see http://cyrilmottier.com/2013/01/23/android-app-launching-made-gorgeous/ thanks to corwin32)

I've lost a lot of time before find this searching on forum & Internet; maybe is trivial but I want to share to spare time for all

My scenary is Android SDK 23

1)
B4X:
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: false
#End Region

2) Add to manifest:
B4X:
SetApplicationAttribute(android:theme, "@style/AppTheme")

3) Normally, when using such libraries, it needs own resources so this line must be attached on code:

B4X:
#AdditionalRes: ..\Resource

3) Create style.xml file on \Resource\values with this content: (or with another Appcompat theme with no Action Bar)

B4X:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowActionBar">false</item>
    <item name="android:windowFullscreen">true</item>
    <item name="android:windowContentOverlay">@null</item>
</style>
</resources>

When you run your app with this instructions, action bar will not display on your activity (nor in the app launching process)
 
Last edited:

ilan

Expert
Licensed User
Longtime User
sorry but i am not able to make it.

i am getting an error.

do i create Resource directory in Objects and inside directory values?
do i need to set them ReadOnly?

do i have to add this line? or the full path?
B4X:
#AdditionalRes: ..\Resource
 

inakigarm

Well-Known Member
Licensed User
Longtime User
No, Resource is a directory at same level as File and Objects
:
Files
Objects
Resource

This line (additionalRes) as stated is OK

Note that is a tip for an Appcompat case, and it's possible that making this changes directly on res directory (below Objects directory) is enough
 

ilan

Expert
Licensed User
Longtime User
i dont know what i am making wrong :(

B4A version: 6.30
Parsing code. (0.07s)
Compiling code. (0.09s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. Error
..\resource\values\style.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.NoActionBar'.
 

ilan

Expert
Licensed User
Longtime User
ok instead of creating an xml file i just add 3 lines to my manifest and no title bar anymore :)

the 3 lines are:

B4X:
    android:windowActionBar="false"
    android:windowFullscreen="true"
    android:windowNoTitle="true"

so my manifest look like this:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="14"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:windowActionBar="false"
    android:windowFullscreen="true"
    android:windowNoTitle="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

thanx @inakigarm :)
 
Top