c# - Xamarin 表单按钮在 iOS 上带有文本和矢量图像

标签 c# ios xamarin xamarin.forms

在我的 Xamarin.Forms PCL 项目中,我尝试创建一个按钮,其中的文本显示在图像下方。但是一旦我添加图像(这是一个矢量图像 - 并且无法指定大小?) - 文本就会消失。仅显示图像。

关于为什么显示图像时文本消失有什么想法吗?

我的代码:

<?xml version="1.0" encoding="UTF-8"?>
<Button xmlns="http://xamarin.com/schemas/2014/forms" 
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        x:Class="MyProj.Views.ToolbarButtonView"
        Text="hello" 
        Image="myvectorimage" 
        ContentLayout="Top,1" >
</Button>

感谢您的帮助!

最佳答案

Here(Kevin)是解释 Button 上的图像和文本的更好答案。

我认为最好使用带有 Image 和 Label 的 StackLayout(添加 TapGesture)而不是 Button。更可控。

关于c# - Xamarin 表单按钮在 iOS 上带有文本和矢量图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47079108/

相关文章:

c# - 如何从路径和文件名中删除非法字符?

ios - 发送 NSNotification 时,CustomCell 中的 UIProgressView 从不显示

android - 应用程序启动何时涉及仪器?

c# - 使用 C# 作为后台代码在 Xamarin Forms 的框架内创建 StackLayout

xamarin - 无法从程序集中加载 "Xamarin.Build.Download.XamarinBuildAndroidAarProguardConfigs"任务

c# - 解决 C# 中的 CS0649 警告

c# - 如何在 MassTransit 和 Automatonymous 中配置 EF Core 持久性?

c# - 按日期范围分组,在每个组内计数和排序 LINQ

ios - 无法获取 UIView 大小

ios - 在没有动画效果的avplayerlayer上设置videogravity