Problem with action bar when changing the device display DPI

Hi,

one feature in Android N is that you can change your device display DPI (http://www.androidpolice.com/2016/03/10/android-n-feature-spotlight-easily-change-your-devices-display-dpi-with-screen-zoom/)

the problem i am facing is that my app is only displayed propertly when this option is set to the minimum otherwise the bottom navigation bar (the one at the bottom with the 3 android action buttons) covers the app (hiding the bottom part of the app)

file

Hi zaulin,

could you please provide code for a small reproduction that manifests the issue on Android N?

I am not 100% sure this code will do it as i don’t have my android n device with me but i took the code that was causing the problem and “cleaned it” to just leave the key parts

 <App>

    <DockPanel>

        <StatusBarBackground Background="#f0f" Dock="Top"/>
        <iOS.StatusBarConfig Style="Light"/>

        <BottomBarBackground IncludesKeyboard="false" Dock="Bottom"/>

        <Panel Background="#fff">
        </Panel>

        <Panel Dock="Bottom" Height="30" Background="#f00">
        	<Text Value="Bottombar"/>
        </Panel>
        
    </DockPanel>

</App>

I just tried the code in the device and i can confirm i get the same result: the action bar “covers” the red panel at the bottom

Thanks for reporting, we have filed a ticket on this issue.

zaulin: I think the problem is with your example. You have two elements with Dock="Bottom" there, and I have a feeling you intended to just have one.

This application seems to do the right thing for me, no matter what setting I use for the Android N “Display Size”-setting.

<App>
	<DockPanel>
		<StatusBarBackground Background="#0f0" Dock="Top"/>
		<BottomBarBackground Background="#f00" Dock="Bottom" IncludesKeyboard="false"/>

		<Rectangle Color="#0ff">
			<Stroke Width="3">
				<SolidColor Color="#f00" />
			</Stroke>
		</Rectangle>
	</DockPanel>
</App>

Hi,

thnx for the reply… but one doubt: Is not possible to have 2 “dock=Bottom” ? I thought it just “stacked” the elements on the bottom

zaulin@yahoo.com wrote:

Hi,

thnx for the reply… but one doubt: Is not possible to have 2 “dock=Bottom” ? I thought it just “stacked” the elements on the bottom

zaulin: You can, but the panel you put the “Bottombar”-text inside was not the actual bottom-bar.

right but i expect that nothing in my app is covered by the android action bar.

Do you mean that if i have a dockpanel that fills all the screen nothing will be covered by the android action bar but if i have more than one “dock=bottom” it will be covered under certain circumstances? (like: android n)

According to:

https://www.fusetools.com/community/forums/bug_reports/bottombarbackground_problem?page=1

If i understood correctly I think the first code should work (and actually it does in all devices BUT android n when DPIs not set to minimum)

zaulin@yahoo.com wrote:
right but i expect that nothing in my app is covered by the android action bar.

This is exactly the purpose <BottomBarBackground Dock="Bottom" /> is supposed to solve.

Do you mean that if i have a dockpanel that fills all the screen nothing will be covered by the android action bar but if i have more than one “dock=bottom” it will be covered under certain circumstances? (like: android n)

No.

An empty dockpanel will be partially obscured by both the status-bar and action-bar. And if you add more than one Dock=“Bottom”, everything works as expected.

What I’m saying is that this works for me as-is. Here’s an example that should show what’s going on, and I’ve confirmed that it does the right thing, regardless of the Android N “Display Size”-setting:

<App>
    <DockPanel>
        <StatusBarBackground Background="#0f0" Dock="Top" />

        <BottomBarBackground Background="#f00" Dock="Bottom" IncludesKeyboard="false">
            <Text Value="This is behind the action-bar" />
        </BottomBarBackground>
        
        <Rectangle Color="#0ff">
            <Stroke Width="3">
                <SolidColor Color="#f00" />
            </Stroke>
        </Rectangle>
        
        <Panel Dock="Bottom" Height="30">
            <Rectangle Color="#f0f">
                <Stroke Width="3">
                    <SolidColor Color="#0f0" />
                </Stroke>
                <Text Value="This is docked to the bottom, but visible" />
            </Rectangle>
        </Panel>
    </DockPanel>
</App>

your code in my android n device:

Hey zaulin, what’s the device?

@zaulin: Interesting. It works as expected (not cutting off at the bottom) on my Android N device (Sony Xperia Z5 Compact), so it doesn’t appear to be a general problem with this functionality. But what you’re observing here is clearly not what should happen, and warrants further inspection. If you can tell us what device you experience this problem on, I can see if I can reproduce the issue on the same or a similar device…

It’s a Huawai:

@zaulin: Unfortunately, I don’t have access to that specific phone, but as it’s a Nexus-phone, it should run an untainted Android-version, so hopefully this reproduces on another Android 7.1.2 device. My device runs Android 7.0, so that might be the reason for the difference.

But, after looking through the code, I got one small hunch… Does this problem go away if you restart the app after changing the “Display Size”-setting? If so, it might be a logic-error in when we re-compute the height of the bottom-bar…

If i first set the diplay size and then i open the app it works propertly

p.s: i had the same problem when testing on the same device with android 7.0.1

just curious:

In version 1.8

Android
Fixed a defect that performed layout with a 0 density on Android at startup

is that bug? :slight_smile: