Xamarin Forms设置底部TabBar时TabIndicator不显示问题求助
问题:Xamarin Forms底部TabBar指示器不显示
我在开发Xamarin Forms项目时,需要将某TabbedPage的TabBar置于底部,但设置android:TabbedPage.ToolbarPlacement="Bottom"后,TabIndicator无法显示。由于使用NavigationPage.HasNavigationBar="False"时Xamarin Community Toolkit的TabView存在Bug,无法改用该组件。移除android:TabbedPage.ToolbarPlacement后,TabIndicator可正常显示。
相关代码
LifeDueTabbedRM.xaml
<?xml version="1.0" encoding="utf-8" ?> <TabbedPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:android="clr-namespace:Xamarin.Forms.PlatformConfiguration.AndroidSpecific;assembly=Xamarin.Forms.Core" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" NavigationPage.HasNavigationBar="False" android:TabbedPage.ToolbarPlacement="Bottom" x:Class="RSMapp.Views.RM.Life.LifeDueTabbedRM"> </TabbedPage>
LifeDueTabbedRM.xaml.cs
public partial class LifeDueTabbedRM : TabbedPage { public LifeDueTabbedRM() { InitializeComponent(); } public LifeDueTabbedRM(string c, string u) { InitializeComponent(); this.Children.Add(new InforceDueView(c, u)); this.Children.Add(new LapsDueView()); this.UnselectedTabColor = Color.White; this.SelectedTabColor = Color.Blue; this.BarBackgroundColor = Color.FromHex("#f2b22c"); } }
Android项目TabBar布局
<?xml version="1.0" encoding="utf-8"?> <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/ThemeOverlay.AppCompat.Dark.ActionBar" app:tabIndicatorColor="#05d1f0" app:tabIndicatorGravity="top" app:tabIndicatorHeight="1dp" app:tabGravity="fill" app:tabMode="fixed" />
正常显示的TabBar指示器截图

内容的提问来源于stack exchange,提问作者D.madushanka
相关产品推荐
相关产品推荐

