question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Close Button Behind Frame

See original GitHub issue

I seem to be having this issue in the Android version of Rg.Plugins.Popup.

croppedscreenshot

My Design Code:

<?xml version="1.0" encoding="utf-8" ?>
<pages:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
             xmlns:animations="clr-namespace:Rg.Plugins.Popup.Animations;assembly=Rg.Plugins.Popup"
             x:Class="Proj.MessagePopupPage"
             CloseWhenBackgroundIsClicked="True">
  <pages:PopupPage.Resources>
    <ResourceDictionary>
      <Style x:Key="EntryStyle" TargetType="Entry">
        <Setter Property="PlaceholderColor" Value="#9cdaf1" />
        <Setter Property="TextColor" Value="#7dbbe6" />
      </Style>
    </ResourceDictionary>
  </pages:PopupPage.Resources>
  <pages:PopupPage.Animation>
    <animations:ScaleAnimation
      PositionIn="Bottom"
      PositionOut="Center"
      ScaleIn="1"
      ScaleOut="0.7"
      DurationIn="700"
      EasingIn="BounceOut"/>
  </pages:PopupPage.Animation>
  <ScrollView
    HorizontalOptions="Center"
    VerticalOptions="Center">
    <AbsoluteLayout>
      <Frame x:Name="FrameContainer" Margin="5"  HorizontalOptions="Center" BackgroundColor="White">
        <StackLayout IsClippedToBounds="True" Padding="10, 5" Spacing="3">
          <Label Text="To:" x:Name="ToLabel" />
          <Entry />
          <Label Text="Message:" x:Name="MessageLabel" />
          <Editor
            HorizontalOptions="Center"
            WidthRequest="200"
            HeightRequest="100"
            x:Name="MessageEntry"
            Style="{StaticResource EntryStyle}" />
          <Button
            BackgroundColor="#227FC8"
            HorizontalOptions="Fill"
            TextColor="White"
            WidthRequest="200"
            Clicked="OnSend"
            x:Name="SendButton"
            Text="Send">
            <Button.HeightRequest>
              <OnPlatform x:TypeArguments="x:Double" Android="50" iOS="30" WinPhone="30" />
            </Button.HeightRequest>
          </Button>
        </StackLayout>
      </Frame>
      <ContentView
          AbsoluteLayout.LayoutFlags="PositionProportional"
          AbsoluteLayout.LayoutBounds="1, 0, -1, -1">
        <ContentView.GestureRecognizers>
          <TapGestureRecognizer Tapped="OnCloseButtonTapped"/>
        </ContentView.GestureRecognizers>
        <Image
          x:Name="CloseImage"
          HeightRequest="30"
          WidthRequest="30">
          <Image.Source>
            <OnPlatform
              x:TypeArguments="ImageSource"
              Android="close_circle_button.png"
              iOS="close_circle_button.png"
              WinPhone="Assets/close_circle_button.png"/>
          </Image.Source>
        </Image>
      </ContentView>
    </AbsoluteLayout>
  </ScrollView>
</pages:PopupPage>

Which is based around the pop up login page.

I have tried 1.1.0-pre3 but that didn’t work.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
GyllionVanElderencommented, Nov 7, 2017

It has to do with Android and frames. I figured out that if you put the content of a frame in a Grid, it will adjust the z-index of the elements. Try maybe the following code and see what it looks like:

<StackLayout VerticalOptions="Center" HorizontalOptions="Center">
        <Frame
            x:Name="FrameContainer"
            Margin="15"
            HorizontalOptions="Center"
            BackgroundColor="White"
            IsClippedToBounds="False">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="10*" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <StackLayout
                    Padding="10, 5"
                    Spacing="3"
                    Grid.Row="0" 
                    Grid.Column="0">
                    
                    <!-- Your Elements here -->

                <ContentView Grid.Row="0" 
                             Grid.Column="1">
                    <AbsoluteLayout>
                        <!--<ContentView.GestureRecognizers>
                    <TapGestureRecognizer Tapped="OnCloseButtonTapped"/>
                </ContentView.GestureRecognizers>-->
                        <Image x:Name="CloseImage"
                               HeightRequest="30"
                               WidthRequest="30"
                               AbsoluteLayout.LayoutFlags="PositionProportional"
                               AbsoluteLayout.LayoutBounds="1.1, 0, -1, -1">
                            <Image.Source>
                                <OnPlatform
                                    x:TypeArguments="ImageSource"
                                    Android="close_circle_button.png"
                                    iOS="close_circle_button.png"/>
                            </Image.Source>
                        </Image>
                    </AbsoluteLayout>
                </ContentView>
            </Grid>
        </Frame>
</StackLayout>
1reaction
EmilAlipievcommented, Dec 27, 2017

see this question and answer on stackoverflow. it is problem of xamarin.forms

https://stackoverflow.com/questions/45427276/absolutelayout-doesnt-align-controls-as-expected-when-positions-are-same

Read more comments on GitHub >

github_iconTop Results From Across the Web

Closing JFrame with button click [duplicate] - java
I have the jButton1 private member of JFrame and i wanted to close the frame when the button is clicked. jButton1.addActionListener(new ...
Read more >
Making a button close the current frame that is opened
I would like it so that when a button is pressed and another guis frame is opened it will close it out and...
Read more >
How to close JFrame on the click of a Button in Java
Set frame.dispose() on the click of a button to close JFrame. At first create a button and frame − JFrame frame = new...
Read more >
Thread: How to override close button of a frame?
Hello, How do I override the close button of a frame, so that i can minimise the form when the user clicks the...
Read more >
[2.9.0] Frame close button - wxWidgets Discussion Forum
How does one connect the Frame close button on the title bar to the frame's custom exit method OnExit() for closing exiting the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found