【问题标题】:Xamarin forms button with both text and vector image on iOSXamarin 在 iOS 上形成带有文本和矢量图像的按钮
【发布时间】:2017-11-03 16:42:31
【问题描述】:

在我的 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>

感谢您的帮助!

【问题讨论】:

  • 添加一个图像,其中包含您想要观看按钮和实际按钮的表单。了解更多详情。

标签: c# ios xamarin xamarin.forms


【解决方案1】:

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

我认为最好使用带有图像和标签的StackLayout(添加 TapGesture)而不是按钮。更可控。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多