baskren / Forms9Patch

Simplify image management and text formatting in your Xamarin.Forms apps
http://Forms9Patch.com
Other
127 stars 33 forks source link

Label cutoff [Android] #6

Closed jvhgamer closed 5 years ago

jvhgamer commented 5 years ago

Sample image (black boxes for reference of item1 and item2). Full text: SAMPLE TEXT ENTRY.

Label is being cutoff with the following settings:

lblTest = new Forms9Patch.Label
{
    Text = "textSet@Runtime",
    TextColor = Color.Black,
    BackgroundColor = Color.Transparent,
    HorizontalOptions = LayoutOptions.FillAndExpand,
    VerticalOptions = LayoutOptions.Center,
    FontSize = 40,
    Lines = 1,
    AutoFit = Forms9Patch.AutoFit.Width,
};

Inside of parent...

gridTest = new Grid
{
    RowDefinitions =
    {
        new RowDefinition { Height = new GridLength(1, GridUnitType.Star) },
    },
    ColumnDefinitions =
    {
        new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) },
        new ColumnDefinition { Width = new GridLength(10, GridUnitType.Star) },
        new ColumnDefinition { Width = new GridLength(2, GridUnitType.Auto) },
    },
    HorizontalOptions = LayoutOptions.FillAndExpand,
    VerticalOptions = LayoutOptions.Start,
    BackgroundColor = Color.White,
    Padding = new Thickness(10, 0),
};
gridTest.Children.Add(item1, 0, 0);
gridTest.Children.Add(lblTest, 1, 0);
gridTest.Children.Add(item2, 2, 0);

Cutoff only occurring on Android. iOS appears fine.

baskren commented 5 years ago

@jvhgamer: I just uploaded 1.6.6.2 to address an issue that sounds a lot like the one you are seeing. Please give it a try and let me know if your issue persists. If it does, please provide me a sample project via a github repo that demonstrates the issue. The code sample you provided is not sufficient to determine the root cause.

jvhgamer commented 5 years ago

@jvhgamer: I just uploaded 1.6.6.2 to address an issue that sounds a lot like the one you are seeing. Please give it a try and let me know if your issue persists. If it does, please provide me a sample project via a github repo that demonstrates the issue. The code sample you provided is not sufficient to determine the root cause.

Sample project via github repo Edit: Updating to 1.6.6.2 did not fix the issue.

baskren commented 5 years ago

Jack -

I just downloaded your app and ran it. Attached is a gif of what I saw. What is wrong with what I’m seeing?

https://1drv.ms/u/s!AkPAsLOJX3DCikXNzgjpz5M3Gw5Q

Ben Askren BuildCalc developer ben@buildcalc.com

http://buildcalc.com/ http://buildcalc.com/

On Apr 8, 2019, at 1:42 PM, Jack Higgins notifications@github.com wrote:

@jvhgamer https://github.com/jvhgamer: I just uploaded 1.6.6.2 to address an issue that sounds a lot like the one you are seeing. Please give it a try and let me know if your issue persists. If it does, please provide me a sample project via a github repo that demonstrates the issue. The code sample you provided is not sufficient to determine the root cause.

Sample project via github repo https://github.com/jvhgamer/Forms9Sample — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/baskren/Forms9Patch/issues/6#issuecomment-480932483, or mute the thread https://github.com/notifications/unsubscribe-auth/ACaWeCsjFzLyIiM58QSeGlurPHvljvY3ks5ve3-agaJpZM4cdjSI.

jvhgamer commented 5 years ago

@baskren Did you make any changes? Here's what I'm seeing. The end of the label is cutoff as if by a margin

baskren commented 5 years ago

zero changes. Loaded it up and ran it.

Ben Askren BuildCalc developer ben@buildcalc.com

http://buildcalc.com/ http://buildcalc.com/

On Apr 8, 2019, at 6:58 PM, Jack Higgins notifications@github.com wrote:

@baskren https://github.com/baskren Did you make any changes? Here's https://we.tl/t-Pd0f5ds9g3 what I'm seeing. The end of the label is cutoff as if by a margin

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/baskren/Forms9Patch/issues/6#issuecomment-481037970, or mute the thread https://github.com/notifications/unsubscribe-auth/ACaWeM6S9SMxG0SAQej8OEmxAFpECG2Cks5ve8mUgaJpZM4cdjSI.

baskren commented 5 years ago

@jvhgamer What happens when you run it on the emulator?

baskren commented 5 years ago

@jvhgamer What happens when you replace the two images with BoxView { Color = Color.Black } ?

jvhgamer commented 5 years ago

@baskren how is it possible the same solution, untouched, shows different results? I'm running this on a Galaxy S9+. Could this be a device specific issue? Perhaps a setting within the device settings?

jvhgamer commented 5 years ago

@baskren Works perfectly on the emulator. What could this setting be? I'm not familiar with Android. Current device font settings: Screen Zoom - Small; Font Size - Middle; Font Style - Default

baskren commented 5 years ago

Your hypothesis about it being a device specific issue could be the root cause. Thank you for letting me know you were testing on a Galaxy S9+. I’ll look up the specs to see if I can build an emulator with the same properties (I would recommend you try it too). That might lead me to the offending code.

Ben Askren BuildCalc developer ben@buildcalc.com

http://buildcalc.com/ http://buildcalc.com/

On Apr 9, 2019, at 12:18 PM, Jack Higgins notifications@github.com wrote:

@baskren https://github.com/baskren Works perfectly on the emulator. What could this setting be? I'm not familiar with Android

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/baskren/Forms9Patch/issues/6#issuecomment-481320959, or mute the thread https://github.com/notifications/unsubscribe-auth/ACaWeBUeM1F16DfFWDhyqlYOYX5PT5RHks5vfL0_gaJpZM4cdjSI.

jvhgamer commented 5 years ago

Will do. Adding the Galaxy S9+ skin via Android AVD is not working but can test based on device specs. More device info: Running Android 8.0.0, Samsung Experience version 9.0

baskren commented 5 years ago

@jvhgamer

I just built an emulator to the same specs as the Galaxy S9+ (1440x2690, 529dpi). I could not replicate the issue you are seeing. Let me know if you have any other ideas on how I can replicate this issue.

baskren commented 5 years ago

@jvhgamer

I think I figured out what's happening. In Settings / Display / Advanced / Font Size and return the font size to "Default". You should see things work as they should.

Now I need to see what I'm doing wrong!

jvhgamer commented 5 years ago

Yes indeed that was it. Two things: the path as it unfolded on my physical device (GS9+): Settings -> Display -> Font and screen zoom -> FONT SIZE. On this device there are seven (7) notches ranging from Tiny to Huge. Font Size was set to four (4) previously, or, the absolute middle of this range. Setting the notch to three (3), one below the middle line, addressed the bug. Many thanks for looking into this and the willingness to see this issue through.

jvhgamer commented 5 years ago

@baskren Can't say I know much if anything about restricting these font size adjustments but a possible solution might be to enforce the app's text as this default. Android solution! Changing preferred text size seems to not affect the label on iOS!

baskren commented 5 years ago

@jvhgamer

I just uploaded v1.6.7 to Nuget.org. It addresses the root cause of this issue. With this version, you should be able to change the System FontSize without causes Forms9Patch.Label's autofit algorithms to fail.