UdaraAlwis / XFSegmentedControl

Segmented Button Control in pure Xamarin.Forms!
https://theconfuzedsourcecode.wordpress.com/tag/segmented-control/
GNU General Public License v3.0
25 stars 5 forks source link

Xamarin forms 4.4.0 gives layout issues on Android #6

Open galadril opened 4 years ago

galadril commented 4 years ago

There is a layout issue if you update the Android/Xamarin Forms libraries like shown in the screenshot below: afbeelding

Then the visibility of the label/horizontal view isn't set correctly anymore when you use the tab button. It is still working if you set the SelectedTabIndex (so dont use the button).

Screenshots Screenshot_2020-01-06-16-43-05-673_com companyname XFSegmentedControl

Screenshot_2020-01-06-16-42-55-362_com companyname XFSegmentedControl

Screenshot_2020-01-06-16-43-10-844_com companyname XFSegmentedControl

galadril commented 4 years ago

Probably related to https://github.com/UdaraAlwis/XFSegmentedControl/issues/3

galadril commented 4 years ago

I've changed the code of the control a bit, so it works on the latest fast renderers on Android.


<?xml version="1.0" encoding="UTF-8" ?>
<Grid
    x:Class="Xam.Controls.TabButton"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    IsClippedToBounds="True"
    RowSpacing="0">
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="1" />
    </Grid.RowDefinitions>
    <Button
        x:Name="TabButtonView"
        Grid.Row="0"
        Margin="-2,-3,-2,0"
        Clicked="TabButton_OnClicked" />
    <BoxView
        x:Name="HorizontalIndicator"
        Grid.Row="1"
        HeightRequest="2"
        InputTransparent="True"
        IsVisible="False"
        VerticalOptions="End" />
</Grid>

So I've set the horizonal line to the second row of the grid, with height 1 on the grid