c# - 如何使用 Xamarin 表单中的滚动菜单制作多个内容页面的选项卡式页面?

标签 c# xamarin xamarin.forms tabbedpage

我想制作一个包含 7 个内容页面的标签页(以 xamarin 形式,不在 native 项目中)。但是红色的菜单栏(我不知道这个东西叫什么所以我就叫它菜单栏)不是滚动菜单,所以每个内容页面的标题都没有很好地显示。像这样:

我真正拥有的东西
the thing that I actually have

有人知道做这样的东西吗?

我想要的东西
thing that I want it to be

最佳答案

没有看到一些代码就不能说太多! - 但我的假设是你的问题出在你的主题上......

打开“Tabbar.axml”并更改这行代码:

app:tabMode="fixed" 

收件人:

app:tabMode="scrollable"

更新:

然后只需添加新行 app:tabMode="scrollable" 因为默认情况下是“固定的”

无论如何,这里是我的 Tabbar.axml :

<?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/colorPrimaryDark"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:tabIndicatorColor="@android:color/white"
    app:tabGravity="fill"
    app:tabMode="scrollable" />

关于c# - 如何使用 Xamarin 表单中的滚动菜单制作多个内容页面的选项卡式页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45478735/

相关文章:

c# - 我想从 C# 中的选择查询中获取 id,但每次运行程序时,查询都会返回 "-1"

xamarin - 我可以全局应用[XamlCompilation(XamlCompilationOptions.Compile)]吗?

c# - 将 Xamarin.forms 应用程序上的目标框架从 Android 8.1 更改为 Android 9(对于 Xamarin.Essentials)

c# - 如何在适用于 iOS 的 Xamarin Forms 中创建导航栏?

listview - 如何在 ListView 中隐藏滚动条

c# - 乘除固定比例小数的最有效方法

c# - 我如何检查用户是否处于具有 MVC4 简单成员资格的几个不同角色中的任何一个?

c# - Xamarin IOS 加载 View 表单手势事件

c# - 从 FirstPersonController 访问另一个脚本

android - 无法为学生创建 Xamarin 帐户