C# Xamarin表单:未显示浮动操作按钮
我试图在我的xamarin表单项目中显示浮动操作按钮。 我正在使用下面的xaml文件,按钮没有显示,但我不明白为什么。请帮我解决这个问题。我正在使用FAB.FORMS库显示浮动操作按钮:C# Xamarin表单:未显示浮动操作按钮,c#,xamarin.forms,C#,Xamarin.forms,我试图在我的xamarin表单项目中显示浮动操作按钮。 我正在使用下面的xaml文件,按钮没有显示,但我不明白为什么。请帮我解决这个问题。我正在使用FAB.FORMS库显示浮动操作按钮: <?xml version="1.0" encoding="UTF-8"?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/wi
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:fab="clr-namespace:FAB.Forms;assembly=FAB.Forms"
x:Class="iFocusDiscussionForum.PostList" Title="Discussion List" >
<ContentPage.Content>
<RelativeLayout>
<ContentView
RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}">
<ListView x:Name="listview" RowHeight="120" ItemSelected = "OnItemSelected">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="5" Margin="5">
</StackLayout>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentView>
<fab:FloatingActionButton
Source = "plus.png"
Clicked = "Handle_Clicked"
Size="Normal"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant=-60}"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1, Constant=-60}"/>
<!--<StackLayout HorizontalOptions="End" VerticalOptions="End" BackgroundColor="#F4F5F8">
<fab:FloatingActionButton x:Name="testing" Image="plus.png" Clicked="testingClicked" BackgroundColor="#F4F5F8" BorderColor="Transparent" />
</StackLayout>-->
</RelativeLayout>
</ContentPage.Content>
</ContentPage>
您需要添加
FloatingActionButtonRenderer.InitControl()将>编码到AppDelegate.cs中
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.FontAwesomeModule());
ImageCircleRenderer.Init();
TintedImageRenderer.Init();
FloatingActionButtonRenderer.InitControl();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
您需要添加FloatingActionButtonRenderer.InitControl()将>编码到AppDelegate.cs中
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.FontAwesomeModule());
ImageCircleRenderer.Init();
TintedImageRenderer.Init();
FloatingActionButtonRenderer.InitControl();
LoadApplication(new App());
return base.FinishedLaunching(app, options);
}
使用vertical options=“Start”@MikeDarwish将浮动按钮放入堆栈布局,它不起作用。您可以展示一个示例吗?使用vertical options=“Start”@MikeDarwish将浮动按钮放入堆栈布局,它不起作用。您可以展示一个示例吗