Android Question B4A 13.4, Android 35 -> Screen size/display problems

mw71

Active Member
Licensed User
Longtime User
Hi,

I have now updated to B4A 13.4 with Android 36 Platform.

My app still works with panels.
However, the panel (into which a scrollview is loaded and then the layout) is no longer limited at the top by the bar (StdActionBar) and at the bottom by the “Android keys,” but is stretched across the entire screen.

How can I fix this so that it is still limited at the top by the StdActionBar and at the bottom by the Android keys in Android 35? I would like to keep my theme.

In the manifest, I have the following:
SetApplicationAttribute(android:theme, “@style/MyTheme”)

and in the code, I can switch between "android:style/Theme.Holo.Light" and "android:style/Theme.Holo".
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
@mcqueccu , thanks for your feedback.
I am familiar with Erel's post and have tried to find a solution using it, but unfortunately, I was not successful.
I suspect the reason is that I am not using the default themes (Themes.LightTheme/Themes.DarkTheme),
but rather the Holo themes, which I would like to continue using.
It may also be due to the panels (which I can't really believe).
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
Manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.basic4ppc.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"
    />)
    
AddActivityText(Main,
  <intent-filter>
  <action android:name="android.intent.action.VIEW" android:exported="true" />
  <category android:name="android.intent.category.DEFAULT" />
  <category android:name="android.intent.category.BROWSABLE" />
  <data android:scheme="$PACKAGE$"/>
  </intent-filter>
   )
 
'wegen Recivern
AddPermission(android.permission.RECEIVE_BOOT_COMPLETED)
AddReceiverText(BackupReciver, <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>)
 
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute(Main, android:windowSoftInputMode, stateHidden|adjustPan)
SetApplicationAttribute(android:theme, "@style/MyTheme")

SetApplicationAttribute(android:icon, "@mipmap/logo")
CreateResource(mipmap-anydpi-v26, ic_launcher.xml,
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/background"/>
    <foreground android:drawable="@mipmap/foreground"/>
</adaptive-icon>
)


CreateResourceFromFile(Macro, Core.NetworkClearText)

AddPermission(android.permission.SCHEDULE_EXACT_ALARM)

AddPermission("android.permission.WRITE_EXTERNAL_STORAGE")



AddApplicationText(
  <provider
  android:name="android.support.v4.content.FileProvider"
  android:authorities="$PACKAGE$.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <meta-data
  android:name="android.support.FILE_PROVIDER_PATHS"
  android:resource="@xml/provider_paths"/>
  </provider>
)
CreateResource(xml, provider_paths,
   <external-files-path name="name" path="" />
)
'Ende of File Provider

'Checkbox
CreateResource(layout, checkbox.xml,
  <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/chk1"

  android:layout_width="85dip"
  android:layout_height="55dip"
  android:button="@null"
android:drawableRight="?android:attr/listChoiceIndicatorMultiple"

  android:tag="chk1" />
)

'''''Checkbox ende

The theme (res.GetResourceId(“style”, “android:style/Theme.Holo.Light”) or res.GetResourceId(‘style’, “android:style/Theme.Holo”)
is stored in a file. When the app is launched, this value is read, stored in the int variable theme_value, and then the theme is set with the following code:
B4X:
#if java
public void _onCreate() {
    if (_theme_value != 0)
        setTheme(_theme_value);
}
#end if

I hope I'm reading my code correctly. It's been a long time since I added this.
I think I found it here: https://www.b4x.com/android/forum/threads/changing-the-theme-at-runtime.57277/#content
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You are NOT using the edgetoedge code in your manifest which you should.

 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
When I run the code here

The generated Holo theme does not have the edge to edge
B4X:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style
        name="DarkTheme" parent="@android:style/Theme.Holo">
    </style>
</resources>

Theme Material has it
B4X:
<?xml version="1.0" encoding="utf-8"?>

<resources>

    <style

        name="DarkTheme" parent="@android:style/Theme.Material">

         <item name="android:actionMenuTextAppearance">@style/LowerCaseMenu</item>

         <item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>

    </style>

     <style name="LowerCaseMenu" parent="android:TextAppearance.Material.Widget.ActionBar.Menu">

        <item name="android:textAllCaps">false</item>

    </style>

</resources>

Its time to leave your Holo theme, and upgrade your interface.
Also test with targetSdkVersion 35
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
You are NOT using the edgetoedge code in your manifest which you should.

I am well aware of that.
I tried to adapt my app accordingly.
Unfortunately, this was unsuccessful, which is why I asked the question.
I assume that it doesn't work because I am NOT using Themes.LightTheme/Themes.DarkTheme but the Holo Theme. According to what Erel wrote, the instructions only apply to LightTheme/DarkTheme (at least that's how I understood it).


When I run the code here

The generated Holo theme does not have the edge to edge
.......
Its time to leave your Holo theme, and upgrade your interface.
Also test with targetSdkVersion 35
The idea of testing Erel's code is a good one.👍

I now have the following in the manifest: CreateResourceFromFile(Macro, Themes.DarkTheme)

This basically works. I now need to look into the handling.
 
Upvote 0
Top