How can I increase the height of an Entry?

rafael.colonrafael.colon ✭✭PRMember ✭✭

I am trying to do it by using HeightRequest and when I do the input does in fact increase its height but the input focus area doesn't increase meaning that if I click on the bottom of the input nothing happens. The input only gets focus when I click on the top.

Best Answers

Answers

  • DavidPerssonDavidPersson ✭✭ USMember ✭✭

    Which platform are you implementing this for?

    Try set up a custom renderer that captures the Click event and fires Control.Focus

  • JohnHardmanJohnHardman mod GBUniversity mod

    @rafael.colon - what are you trying to achieve? Do you want entered text to wrap onto more than one line, or do you want the font to increase in size?

    If you want the text to wrap onto more than one line, you should use the Editor view rather than the Entry view.

  • Gigex42Gigex42 ✭✭✭✭ USMember ✭✭✭✭

    Like @JohnHardman said it depends on what you want to achive.

    Tested it myself, but it works here.
    Doesnt matter where I click on my entry i gets focused.

    Could you give us some code?

  • rafael.colonrafael.colon ✭✭ PRMember ✭✭
    edited July 2016

    @JohnHardman @Gigex42 I want to increase the text box height so its easier for the user to tap in the box. It is a 1 line input just to enter numbers. This is the code I am using and It is Xamarin.Forms. I have tested the code on both iOS and Android but on both of them the text box does in fact increase in size but the focus area is still the default one.

    <StackLayout HorizontalOptions="FillAndExpand"> <Entry Keyboard="Numeric" Placeholder="30" VerticalOptions="Center" HeightRequest="200"/> </StackLayout>

  • rafael.colonrafael.colon ✭✭ PRMember ✭✭
    edited July 2016

    <StackLayout HorizontalOptions="FillAndExpand"> <Entry Keyboard="Numeric" Placeholder="30" VerticalOptions="Center" HeightRequest="200"/> </StackLayout>

  • JohnHardmanJohnHardman mod GBUniversity mod
    edited July 2016

    @rafael.colon - I haven't checked on iOS (build times are horribly slow), but I've checked on both Android and Windows UWP. On both of those platforms, setting HeightRequest both increases the size of the control and accepts focus by tapping/clicking anywhere within the control.

    What version of Xamarin.Forms are you using? I am using 2.3.0.49

  • rafael.colonrafael.colon ✭✭ PRMember ✭✭

    @Gigex42 ``<?xml version="1.0" encoding="UTF-8"?>

    <ContentPage.ToolbarItems>

    </ContentPage.ToolbarItems>

    <ContentPage.Content>
        <StackLayout VerticalOptions="FillAndExpand"
                     HorizontalOptions="FillAndExpand"
                     Orientation="Vertical"
                     Padding="10">
            <Label x:Name="RSPName" HorizontalOptions="Center" />
            <Picker Title="Publications" Items="publications">
                <Picker.Items>
                    <x:String>1</x:String> 
                    <x:String>2</x:String>
                </Picker.Items>
            </Picker> <!-- end Publication Picker -->
    
            <StackLayout VerticalOptions="FillAndExpand"
                     HorizontalOptions="FillAndExpand"
                     Orientation="Vertical"
                     Padding="25"
                     BackgroundColor="White">
                <Label Text="Sun 01/01/2016" HorizontalOptions="Center" />
    
                <StackLayout Orientation="Horizontal" HeightRequest="50" BackgroundColor="White">
                  <StackLayout BackgroundColor="White" HorizontalOptions="FillAndExpand">
                    <Label HorizontalOptions="Center" Text="Draw"/>
                    <StackLayout HorizontalOptions="FillAndExpand">
                        <Entry Keyboard="Numeric" Placeholder="30" VerticalOptions="Center" HeightRequest="200"/>
                    </StackLayout>
                  </StackLayout>
                  <StackLayout BackgroundColor="White" HorizontalOptions="FillAndExpand">
                    <Label HorizontalOptions="Center" Text="Return"/>
                    <StackLayout HorizontalOptions="FillAndExpand">
                        <Entry x:Name="returnEntry" Keyboard="Numeric" Placeholder="30" VerticalOptions="FillAndExpand" />
                    </StackLayout>
                  </StackLayout>
                </StackLayout>
            </StackLayout> <!-- end Draw & Return -->
    
    
        </StackLayout> 
    
    
    </ContentPage.Content>
    


    ``

Sign In or Register to comment.