xamarin表单列表视图操作菜单

时间:2018-09-20 13:30:28

标签: listview xamarin xamarin.forms

有什么方法可以使用xamarin表单进行设计? 当我按三个点时,我想打开图像上的菜单。

编辑:

xamarin-list-view

1 个答案:

答案 0 :(得分:0)

  

当我按下三个点时,我想打开图像上的菜单。

当您以[SerializeField] private GameObject anchorPrefab; private UnityARSessionNativeInterface m_session; // Use this for initialization void Start() { m_session = new UnityARSessionNativeInterface(); Application.targetFrameRate = 60; ARKitFaceTrackingConfiguration config = new ARKitFaceTrackingConfiguration(); config.alignment = UnityARAlignment.UnityARAlignmentGravity; config.enableLightEstimation = true; if (config.IsSupported) { m_session.RunWithConfig(config); UnityARSessionNativeInterface.ARFaceAnchorAddedEvent += FaceAdded; UnityARSessionNativeInterface.ARFaceAnchorUpdatedEvent += FaceUpdated; UnityARSessionNativeInterface.ARFaceAnchorRemovedEvent += FaceRemoved; } } void FaceAdded(ARFaceAnchor anchorData) { if (anchorPrefab != null) { anchorPrefab.transform.position = UnityARMatrixOps.GetPosition(anchorData.transform); anchorPrefab.transform.rotation = UnityARMatrixOps.GetRotation(anchorData.transform); anchorPrefab.SetActive(true); } } void FaceUpdated(ARFaceAnchor anchorData) { if (anchorPrefab != null) { anchorPrefab.transform.position = UnityARMatrixOps.GetPosition(anchorData.transform); anchorPrefab.transform.rotation = UnityARMatrixOps.GetRotation(anchorData.transform); } } void FaceRemoved(ARFaceAnchor anchorData) { if (anchorPrefab != null) { anchorPrefab.SetActive(false); } } // Update is called once per frame void Update() { } void OnDestroy() { if (anchorPrefab != null) { anchorPrefab.SetActive(false); } UnityARSessionNativeInterface.ARFaceAnchorAddedEvent -= FaceAdded; UnityARSessionNativeInterface.ARFaceAnchorUpdatedEvent -= FaceUpdated; UnityARSessionNativeInterface.ARFaceAnchorRemovedEvent -= FaceRemoved; } 的顺序为icon设置ToolbarItem时,这是一个已知问题。

当我查看Secondary源代码时,发现--NavigationPageRenderer

NavigationPageRenderer

这意味着当我们使用foreach (ToolbarItem item in _toolbarTracker.ToolbarItems) { IMenuItemController controller = item; item.PropertyChanged += OnToolbarItemPropertyChanged; if (item.Order == ToolbarItemOrder.Secondary) { IMenuItem menuItem = menu.Add(item.Text); menuItem.SetEnabled(controller.IsEnabled); menuItem.SetOnMenuItemClickListener(new GenericMenuClickListener(controller.Activate)); } else { IMenuItem menuItem = menu.Add(item.Text); UpdateMenuItemIcon(context, menuItem, item); menuItem.SetEnabled(controller.IsEnabled); menuItem.SetShowAsAction(ShowAsAction.Always); menuItem.SetOnMenuItemClickListener(new GenericMenuClickListener(controller.Activate)); } } 中的辅助工具栏项目时,将不会显示任何图标。这是一个设计问题。

错误:Xamarin.Forms Secondary ToolbarItem Icon not showing

GitHub PR修复程序:https://github.com/xamarin/Xamarin.Forms/pull/1873

建议

如果必须在项目中实现此功能,则需要重写Xamarin.Form,它将非常复杂。