Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

How to create chat-like footer layout in Xamarin Forms?

$
0
0

I'm using Xamarin Forms to create a chat-like app for Abdroid and UWP. I want to create a footer layout that looks something like this
(Meaning 2 buttons and an Editor in horizontal orientation).

I have created the layout in the image using the following xaml:

<Grid >
        <Grid.Margin>
            <OnPlatform x:TypeArguments="Thickness">
                <On Platform="Android">5,0,5,5</On>
                <On Platform="Windows">5,0,5,25</On>
            </OnPlatform>
        </Grid.Margin>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
        </Grid.ColumnDefinitions>

        <Editor x:Name="MessageText"  Text="" Grid.Column="0" />
        <local:RoundedButton x:Name="Button2" Clicked="click2"  BackgroundColor="#000000" Grid.Column="1" WidthRequest="50" HeightRequest="50" BorderRadius="25" VerticalOptions="Center" />
        <local:RoundedButton x:Name="Button1" Clicked="click1"  BackgroundColor="#000000" Grid.Column="2" WidthRequest="50" HeightRequest="50" BorderRadius="25" VerticalOptions="Center"/>
</Grid>

The problem with this layout is that the Editor doesn't display fully more than one line. When I continue writing text that is longer than the Editor's width I get something like this. As you can see the first line is cut-of and only the bottom of it is displayed when I start a new line.

As far as I know, it is pretty easy to create this kind of layout in Android using LinearLayout and the layout_weight attribute. But I try to avoid creating a renderer for the whole footer for now.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>