Реализуйте плавающее меню действий, используя этот пример кода, который использует сетку и макет стека, в относительном макете - PullRequest
0 голосов
/ 27 мая 2019

Это то, что я пытаюсь реализовать в относительной компоновке:

https://2.bp.blogspot.com/-mUrMhKL8Yus/WlckSl9aAcI/AAAAAAAAA0o/xHITNGcIEpUscx86VQeB3t9B_JslWdsFQCK4BGAYYCw/s1600/via.gif

Это ссылка на github:

https://github.com/winstongubantes/Xamarin.Forms/tree/master/FloatingActionButton

В моем текущем коде это просто не подходит. Поэтому я только опубликовал свой код. В поисках большего количества головок, например, как я могу соответствовать этому в относительной компоновке.

Color = "LightGray" RelativeLayout.WidthConstraint = "{ConstraintExpression Type = RelativeToParent, Свойство = Ширина, Коэффициент = 1} "
RelativeLayout.YConstraint = "{ConstraintExpression Type = RelativeToView, ElementName = EmailTo,
Свойство = Y, Коэффициент = 1, Константа = 35} />

    <Label Text="Name:" TextColor="Gray" VerticalOptions="End" FontSize="20"
        RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=SeparatorEmailTo, Property=Height, Factor=0,Constant=44}"
        RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0, Constant=10}"
        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width,Factor=.25,Constant=0}"
         />
    <Controls:XEntry Text="" TextColor="Black" x:Name="Name"
        RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView, ElementName=SeparatorEmailTo, Property=Height, Factor=0,Constant=35}"
        RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.3, Constant=0}"
        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width,Factor=0.75,Constant=0}"
        RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=0,Constant=50}" 
         />
    <BoxView x:Name="SeparatorName"
       HeightRequest="1"            
       Color="LightGray"
       RelativeLayout.WidthConstraint = "{ConstraintExpression
                Type = RelativeToParent,
                Property = Width,
                Factor = 1}"  
        RelativeLayout.YConstraint = "{ConstraintExpression
                Type = RelativeToView,
                ElementName = Name,        
                Property = Y,
                Factor = 1,
                Constant = 35}" 
         />

    <ListView x:Name="ListView" HeightRequest="150"
                  RelativeLayout.YConstraint = "{ConstraintExpression
                Type = RelativeToParent,

                Property = Y,
                Factor = 1,
                Constant = 300}">
        <ListView.ItemTemplate>
            <DataTemplate>
                <TextCell Text="{Binding FileName}"
                          Detail="{Binding FilePath}" />
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>

    <Button x:Name="FilePicker"
            Text="Attach File"
            HorizontalOptions="Center"
            VerticalOptions="CenterAndExpand"
            Clicked="LoadFilePicker"
                RelativeLayout.YConstraint = "{ConstraintExpression
                Type = RelativeToView,
                ElementName = ListView,        
                Property = Y,
                Factor = 1,
                Constant = 100}"/>


</RelativeLayout>
...