Android Question transparent activity with appcompat

stm32

Member
Hello Everyone How can I create an transparent activity with appcompat I applied these settings in the manifest but when displaying the activity the background turns black after the activity is fixed
manifest:
SetApplicationAttribute(android:theme, "@style/MyAppTheme")

CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="colorPrimary">#3F51B5</item>
        <item name="colorPrimaryDark">#303F9F</item>
        <item name="colorAccent">#FF4081</item>
        <item name="android:background">@android:color/transparent</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowTranslucentNavigation">true</item>
         <item name="android:windowTranslucentStatus">true</item>
        
    </style>
</resources>
)
 

stm32

Member
Thank you, but I used this code in the manifest and the software gives an error during execution and does not load

B4X:
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:usesCleartextTraffic, "true")

SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values, theme.xml,
<resources>
    <style name="LightTheme" parent="@android:style/Theme.Material.Light.NoActionBar">
       <item name="android:actionMenuTextAppearance">@style/LowerCaseMenu</item>
       <item name="android:background">@android:color/transparent</item>
       <item name="android:windowBackground">@android:color/transparent</item>
       <item name="android:windowIsTranslucent">true</item>
    </style>
     <style name="LowerCaseMenu" parent="android:TextAppearance.Material.Widget.ActionBar.Menu">
        <item name="android:textAllCaps">false</item>
    </style>

</resources>
)

AddPermission(android.permission.ACCESS_NETWORK_STATE)
AddPermission(android.permission.ACCESS_WIFI_STATE)
AddPermission(android.permission.CHANGE_WIFI_STATE)

AddPermission (android.permission.SEND_SMS)
AddPermission(android.permission.RECEIVE_SMS)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

stm32

Member
Find the full error message in the logs and post it. Without it, we can't help you.
Unfortunately, during debugging, the program does not come up at all so that I can copy the error for you. If it is possible, please send me a simple example with the desired manifest so that I can compile it on my computer.
 
Upvote 0

stm32

Member
I noticed that as soon as I remove the following line from the manifest, the program runs, but the same problem persists

B4X:
<item name="android:windowIsTranslucent">true</item>
 
Upvote 0

stm32

Member
A strange thing, now I realized that this problem only occurs on Samsung S7 Galaxy mobile phones and Android 8, but on Android 5 and 12, the program works properly!
 
Upvote 0
Top