- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在我的应用程序中,我使用 Xamarin Shell 创建底部标签栏导航,如下所示:
MainPage.xaml
<!--TabBar Styles and Resources-->
<Shell.Resources>
<ResourceDictionary>
<Style x:Key="FreeStyle" TargetType="Element">
<Setter Property="Shell.TabBarBackgroundColor" Value="#f7f7f7" />
<Setter Property="Shell.TabBarForegroundColor" Value="White"/>
<Setter Property="Shell.TabBarUnselectedColor" Value="#999999"/>
<Setter Property="Shell.TabBarTitleColor" Value="#61c9f7"/>
</Style>
</ResourceDictionary>
</Shell.Resources>
<!--BluePill Pages-->
<TabBar Style="{StaticResource FreeStyle}">
<!--TeleMED Tab-->
<Tab Icon="telemedicineIcon.png">
<ShellContent ContentTemplate="{DataTemplate views:TelemedicineMainPage}"/>
</Tab>
<!--FlemingTab-->
<Tab Icon="chatbotIcon.png">
<ShellContent ContentTemplate="{DataTemplate views:ChatbotPage}"/>
</Tab>
<!--FirstAid Tab-->
<Tab Icon="firstaidIcon.png">
<ShellContent ContentTemplate="{DataTemplate views:FirstAidPage}"/>
</Tab>
<!--User Profile Tab-->
<Tab Icon="profileIcon.png">
<ShellContent ContentTemplate="{DataTemplate views:UserProfilePage}"/>
</Tab>
</TabBar>
在 ChatbotPage.xaml
中,我想完全删除标签栏,因此我在其代码后面实现了 Shell.SetTabBarIsVisible(this, false);
并添加了 TapGesture到其中一个标签,以便它带我返回主页。
每当我运行应用程序并点击 ChatbotPage 中的后退按钮时,我都会收到此异常Java.Lang.IllegalArgumentException:“DrawerLayout 必须使用 MeasureSpec.EXACTLY 进行测量。”
我不知道这意味着什么,想知道是否有任何修复或解决方法?
ChatbotPage.xaml
<!--Chatbot Header and Back Button-->
<Frame BackgroundColor="#f7f7f7" Grid.Row="0" HasShadow="True">
<StackLayout Orientation="Horizontal">
<renderers:FontAwesomeIcon Text="{x:Static helpers:IconsFA.BackArrow}" HorizontalOptions="Start">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="BacktoMain_Button"/>
</Label.GestureRecognizers>
</renderers:FontAwesomeIcon>
<StackLayout Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
<Frame BackgroundColor="Gray"
Padding="0"
CornerRadius="100"
HasShadow="False"
IsClippedToBounds="True"
HeightRequest="35"
WidthRequest="35">
<Image HorizontalOptions="Center"
VerticalOptions="Center"/>
</Frame>
<Label Text="Fleming"
TextColor="Black"
FontAttributes="Bold"
FontSize="18"
VerticalOptions="Center"/>
</StackLayout>
</StackLayout>
</Frame>
ChatbotPage.xaml.cs
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class ChatbotPage : ContentPage
{
public ChatbotPage()
{
InitializeComponent();
Shell.SetTabBarIsVisible(this, false);
}
private async void BacktoMain_Button(object sender, EventArgs e)
{
await Navigation.PushAsync(new MainPage());
}
}
最佳答案
使用 await Navigation.PushAsync(new MainPage());
不会带您返回到您正在使用的 MainPage
,这行代码将推送到新的主页
。
要在选项卡栏下以编程方式选择不同的选项卡,您可以使用:
private void Button_Clicked(object sender, EventArgs e)
{
TabBar bar = Shell.Current.Items[0] as TabBar;
//Select the first Tab
bar.CurrentItem = bar.Items[0];
//If you want to select the second tab, you can use bar.CurrentItem = bar.Items[1]; the same as the third tab, the fourth tab......
}
我上传了一个示例here .
关于java - PushAsync 导航上的 Xamarin Forms 'DrawerLayout must be measured with MeasureSpec.EXACTLY.' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58906519/
我一直在尝试实现塔詹的算法来测量图中的强连通分量。既然我还没有找到任何东西,谁能提供指导,说明如何在阿帕奇时代实现塔詹的算法来测量节点之间的连通性?以下是用python编写的代码。如何使用Apache
我正在尝试更新我的一个 Android 项目的依赖项,但我收到了这个奇怪的错误。 罪魁祸首是这一行,对于 AdMob(我之前使用的是 20.6.0): implementation "com.goog
我在一个目录中有六个 .txt 文件。因此,我创建了一个变量: $foo = gci -Name *.txt $foo 现在是一个包含六个字符串的数组。就我而言,我有 PS > $foo Extens
可能已经在其他一些上下文和依赖项中询问了这个问题。 但即使花了一整天,我仍然无法弄清楚这一点。 所以下面我将完整的错误日志与我的项目级 Gradle 文件和应用级 Gradle 文件一起粘贴。 尝试运
对于我的应用程序,我需要保留用户首选的度量单位。 目前可能的单位是: 升(存储我数据库其余部分的值的单位) 千克(随产品密度变化) 美国液体加仑(3.785411784 升) 美国液体夸脱(以上的 1
我的应用程序遇到性能问题。本质上,我单击一个按钮,列表中填充了数据绑定(bind)数据(由于数据量大,这是虚拟化的),然后单击另一个按钮,该按钮将向关联的 ListView 添加一行。我含糊其词是因为
我需要将一个 Path 对象与另一个进行比较。首先,我在 onTouchEvent 的一个路径中收集所有绘制的对象: switch (event.getAction()) {
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 5 年前。 Improve
swift 4.2 Xcode 10β2 背景 我正在整合一个与天文学相关的 API 来处理我正在开发的应用程序中的数学运算。目的是使用 Measurement 类来处理角度和距离的输入和输出。通过这
前言 View 的工作原理中最重要的就是测量、布局、绘制三大过程,而其中测量是最复杂的; 那么我们就来介绍下View 的测量过程; 1、MeasureSpec 测量自身的大小的时候,会
我知道 getBoundingClientRect() 返回类型为 ClientRect 或 DOMRect 的对象,并且每个对象通常都具有 x、y、width、height 等。如果您 typeof
我有一个脚本来测量执行时间,但是当我使用 Measure-Command 时,我收到了似乎不准确的信息。例如,我自己为脚本计时,大约需要 15 秒才能完成。然而,这里是最后两个输出。如您所见,一个为负
我想从屏幕顶部确定元素的位置。从其他问题来看,一种方法是使用 react native 的 .measure 属性? 引用问题:React Native: Getting the position o
我编写了以下类来通过 GoogleAnalytics 测量我的服务器端流量测量协议(protocol)。 问题是所有活跃的访问者都来自我的服务器当前所在的意大利 - 我假设问题原因来自 fsockop
我想根据规则的数量和规则的复杂性来衡量流口水的表现。因此,我需要测量处理事件所需的时间。我想编写一个像这样的简单测试: long start = System.currentTimeMillis();
考虑以下代码 import numpy as np from skimage import measure def mse(x, y): return np.mean(np.square(x
什么是统一坐标测量? (厘米、米、公里) 如何在其中实现实实在在的措施? 我想在 Unity 中实现一个真正的措施。怎么做? public Vector2 GetAsMeters (Vector2 v
我正在从事一个情感分析项目,而且我是 Python 初学者。我需要计算召回率、精度和 f 度量,但我不知道数据集的语法,如下所示: #The train data format ,contains t
我正在使用 javax.measure 将用户输入转换为秒,秒数可以从秒到天不等,但是从任何单位转换为另一个单位不起作用,这是我设置的。 String units = "d"; double valu
我正在尝试开发 android 应用程序以获取有关网络信息测量的低级信息。 我想知道如何获取这些数据? 3G:-RSCP-ECNO(不是 Eclo)-BER 2G:-RxLevelQuality-Rx
我是一名优秀的程序员,十分优秀!