Increase Touch Area for TapGestureRecognizer

attyranattyran USMember ✭✭

Hello,

I have the following layout below and want to increase the touch area for the label. Is this possible?

    <StackLayout Orientation="Horizontal">
        <Label x:Name="nextButton"
                Text="Next"
                FontSize="Medium"
                HorizontalOptions="EndAndExpand"
                TextColor="Blue">
            <Label.GestureRecognizers>
                <TapGestureRecognizer Tapped="OnNextClicked"/>
            </Label.GestureRecognizers>
        </Label>
    </StackLayout>

Thanks

Best Answer

Answers

  • JohnHardmanJohnHardman GBUniversity mod

    @attyran - If you add a Margin to the Label, does the TapGestureRecognizer operate on the Margin as well? I haven't checked, but it would be the easiest thing to do if it does work.

  • attyranattyran USMember ✭✭
    edited October 2017

    @JohnHardman, seems like that didn't work. That only increases the size of the margins for the buttons, and doesn't affect the touch area.

    @seanyda, thanks for the suggestion. Seems like using Grid layout with a transparent BoxView layout over the label did the trick.

  • You could try to set a FontSize property for the text, and increase the Height property of the label

Sign In or Register to comment.