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