Background Color

I changed ‘android:windowBackground’ and the adobe AIR stage color, but when I run the application there is a black color between the two colors. Is there a way for the black color to not appear?

Render mode “direct”.

<resources>
    <style name="Theme.NoShadow" parent="android:style/Theme.NoTitleBar">
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowBackground">@color/white</item>
    </style>
</resources>
[SWF(width = "320", height = "480", frameRate = "60", backgroundColor = "#ff8800")]

how about mentioning which AIR SDK version you are using, the source code of the sample app, how did you compile, and which version of Android you are testing with, are you testing on real hardware or emulator?

AIR SDK version 32.0.0.89 for Windows 10

Sorce Code:

Test.as

package
{
   import flash.display.Sprite;

   [SWF(width = "320", height = "480", frameRate = "60", backgroundColor = "#ffffff")]

   public class Test extends Sprite
   {
       public function Test()
       {
          
       }
   }
}

Test-app.xml

<?xml version="1.0" encoding="utf-8"?>
<application xmlns="http://ns.adobe.com/air/application/32.0">
	<id>air.test</id>
	<name>Test</name>
	<filename>Test</filename>
	<versionNumber>0.1</versionNumber>
	<supportedProfiles>mobileDevice</supportedProfiles>
	<description>Test</description>
	
	<initialWindow>
		<title>Test</title>
		<content>Test.swf</content>
		<visible>true</visible>
		<fullScreen>false</fullScreen>
		<autoOrients>false</autoOrients>
		<aspectRatio>portrait</aspectRatio>
		<renderMode>direct</renderMode>
		<depthAndStencil>true</depthAndStencil>
	</initialWindow>
	
	<icon>
		<image48x48>icons/icon_48.png</image48x48>
		<image72x72>icons/icon_72.png</image72x72>
		<image96x96>icons/icon_96.png</image96x96>
		<image144x144>icons/icon_144.png</image144x144>
		<image192x192>icons/icon_192.png</image192x192>
		<image512x512>icons/icon_512.png</image512x512>
	</icon>
	
	<android>
		<manifestAdditions>
			<![CDATA[<manifest android:installLocation="auto">
				<uses-sdk android:minSdkVersion="21"/>
				<uses-permission android:name="android.permission.INTERNET" />
			</manifest>]]>
		</manifestAdditions>
	</android>
</application>

styles.xml

C:\airsdk32\lib\android\lib\resources\app_entry\res\values\styles.xml

<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 * ADOBE CONFIDENTIAL
 * __________________
 *
 * Copyright 2009 Adobe Systems Incorporated
 * All Rights Reserved.
 *
 * NOTICE: All information contained herein is, and remains the property of
 * Adobe Systems Incorporated and its suppliers, if any. The intellectual
 * and technical concepts contained herein are proprietary to Adobe Systems
 * Incorporated and its suppliers and may be covered by U.S. and Foreign
 * Patents, patents in process, and are protected by trade secret or
 * copyright law. Dissemination of this information or reproduction of this
 * material is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 */
-->

<resources>
    <style name="Theme.NoShadow" parent="android:style/Theme.NoTitleBar">
        <item name="android:windowTranslucentStatus">true</item>
        <item name="android:windowBackground">@drawable/splash_background</item>
    </style>
</resources>

splash_background.xml

C:\airsdk32\lib\android\lib\resources\captive_runtime\res\drawable\splash_background.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/splash_background_color" />
</layer-list>

colors.xml

C:\airsdk32\lib\android\lib\resources\captive_runtime\res\values\colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="opaque_blue">#00f</color>
    <color name="splash_background_color">#ffffff</color>
</resources>

Compile with vscode as3mxml extension, but same result in animate cc with render mode direct.

Android version 7.1.1 Nougat in real hardware (OppoA83).

I assume you’re compiling to a captive runtime

so I’m a bit outdated on Android development and can not test right now but
I would say what you need is a splash screen (as a bitmap, not just a colored background).

see those 2 older blog posts

<?xml version="1.0" encoding="utf-8"?>
<resources>
  
  <!-- Your AppTheme or other themes/styles here -->
  
  <!-- The launcher theme. It sets the main window background to the launch_screen drawable -->
  <style name=”AppTheme.Launcher”>
    <item name=”android:windowBackground”>@drawable/launch_screen</item>
    <!-- Optional, on Android 5+ you can modify the colorPrimaryDark color to match the windowBackground color for further branding-->
    <!-- <item name="colorPrimaryDark">@android:color/white</item> -->
  </style>
  
</resources>

Also some Android official docs

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
  • and App startup time
    to understand a bit more how things are connected and chained to each other
    for example:

    Cold startup takes 5 seconds or longer.
    Warm startup takes 2 seconds or longer.
    Hot startup takes 1.5 seconds or longer.

  • finally, even dev writing code natively for Android (without AIR) also struggle a lot to get their launch screen right, so yeah you gonna have to do a lot of little tests, with or without some options till it feels right.


I would advise that

  1. play/test with the colorPrimary, colorPrimaryDark and/or colorAccent
    see if it can “fill” the split second black background you’re experiencing
  2. definitively try to use a launch image, not just a windowBackground color, but a bitmap
    even just one color, try with the size ratio of your app, etc.
  3. try also with a gravity centered bitmap(not the full size of the app more like an icon)
    maybe even a transparent PNG :wink:

to me, from the top of my head (so without testing), the black screen you’re seeing in the launch sequence looks like the app is trying to display something but can not find the resource and so default to a black screen for that split second, so my logic is to provide the app that something that is missing, my gut feelings telling me it must be a splash screen or some kind of bitmap.

Also the Android doc App startup time do advice the following

Solutions to the problem

We recommend that, rather than disabling the preview window, you follow the common Material Design patterns. You can use the activity’s windowBackground theme attribute to provide a simple custom drawable for the starting activity.

For example, you might create a new drawable file and reference it from the layout XML and app manifest file as follows:

Layout XML file:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
  <!-- The background color, preferably the same as your normal theme -->
  <item android:drawable="@android:color/white"/>
  <!-- Your product logo - 144dp color version of your app icon -->
  <item>
    <bitmap
      android:src="@drawable/product_logo_144dp"
      android:gravity="center"/>
  </item>
</layer-list>

so yeah … worth a shot

Thanks for helping @zwetan, but didn’t work

I tried it again, it seems like the time needed to start the flash context. Maybe the best solution is not to use adobe air / flash, it seems I regret learning it.

2 posts were split to a new topic: Android splash image over StageWebView with AIR 33.1.1.50