Xamarin.forms TabbedPage中的两个选项卡没有全宽,而是将其文本宽度限制在选项卡的左角
我必须在TabbedPage中填充两个选项卡,使两个选项卡的宽度等于选项卡的一半 以下是我在TabbedPage中的代码:Xamarin.forms TabbedPage中的两个选项卡没有全宽,而是将其文本宽度限制在选项卡的左角,xamarin.forms,xamarin.android,tabbar,tabbedpage,Xamarin.forms,Xamarin.android,Tabbar,Tabbedpage,我必须在TabbedPage中填充两个选项卡,使两个选项卡的宽度等于选项卡的一半 以下是我在TabbedPage中的代码: protected override void OnAppearing() { base.OnAppearing(); EquipmentGeneralInfoTab = new EquipmentGeneralInfoTab() { Title = "General" }; EquipmentMaintenanceT
protected override void OnAppearing()
{
base.OnAppearing();
EquipmentGeneralInfoTab = new EquipmentGeneralInfoTab() { Title = "General" };
EquipmentMaintenanceTab = new EquipmentMaintenanceTab() { Title = "Maintenance" };
this.Children.Add(EquipmentGeneralInfoTab);
this.Children.Add(EquipmentMaintenanceTab);
}
Xaml代码:
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TCRMobile.Pages.EquipmentInfoTabbedPage"
Title="Equipment">
Tabbar.xaml:
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/sliding_tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:theme="@style/Your.Theme"
app:tabIndicatorColor="@color/tcr_green"
app:tabSelectedTextColor="@color/tcr_green"
app:tabTextColor="@color/black"
app:tabGravity="fill"
app:tabMaxWidth="0dp"
app:tabTextAppearance="@style/tab_text"
app:tabMode="scrollable" />
如何完成我的要求?尝试在
Tabbar.xaml中更改以下代码
app:tabMode="scrollable"
到
尝试在Tabbar.xaml中更改以下代码
app:tabMode="scrollable"
到
你使用的是Xamarin.Forms还是Xamarin.Android?我使用的是Xamarin formsHow,你能在Xamarin.ios中实现相同的输出吗?你使用的是Xamarin.Forms还是Xamarin.Android?我使用的是Xamarin formsHow,你能在Xamarin.ios中实现相同的输出吗?谢谢,但我还有一个带有7个标签页的标签页,我需要滚动。有办法处理这两个问题吗?我想它固定的网页,其中有2个标签和滚动的其他?明白了。我修复了使用自定义渲染器的问题。谢谢,它起作用了,但我还有一个选项卡页面,有7个选项卡,我需要可以滚动。有办法处理这两个问题吗?我想它固定的网页,其中有2个标签和滚动的其他?明白了。我修复了使用自定义渲染器的问题。