Xamarin 表单 - 选项卡式视图? [英] Xamarin Forms - Tabbed View?

查看:32
本文介绍了Xamarin 表单 - 选项卡式视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个弹出窗口,其中会有一些选项卡,每个选项卡都包含一个列表视图.我知道有一个 TabbedPage,但我需要一个TabbedView"以便我可以使用 Xlabs PopupLayout 构建我的弹出窗口.如何在 Xamarin Forms 中执行此操作?

I need to create a popup, in which there will be some tabs, each of them containing a listview. I know that there is a TabbedPage, but I need a "TabbedView" so I can build my popup using the Xlabs PopupLayout. How do I do this in Xamarin Forms?

推荐答案

您可以自己创建自定义控件.

You can create a custom control yourself.

(假设您要创建 3 个标签)

(imagine you want to create 3 tabs)

例如,您可以看到它是一个 2 行 3 列的网格.

For example you can have a view that it's a grid with 2 rows and 3 columns.

设置按钮的第一行将 RowHeight 设置为自动或您想要的大小,并将每个按钮添加到每一列.

1st row you set the buttons set the RowHeight to auto or a size you want, and add each button to each column.

在第 2 行,您可以拥有一个 RowHeight 为 * 的 ContentView(以填充其余空间),您还应该将 GridSpan 设置为 3 列,以便填充网格上的所有可用宽度.

On row 2 you can have a ContentView with RowHeight of * (to fill the rest of the space) , you should also set GridSpan to 3 columns so it will fill all width available on the grid.

然后,当您单击一个按钮时,您只需将 ContentView 视图设置为该特定选项卡所需的视图.您还可以在更改内容之前使用动画.

Then when you click a button you just have to set the ContentView view to what you want for that particular tab., you can also have animations before changing the content.

希望能帮到你

这篇关于Xamarin 表单 - 选项卡式视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆