Swiftui-我无法更改屏幕上的Picker文字的样式
我有一个这样的选择器:
Picker(languages[currentIndex].name,selection: $currentIndex){
ForEach(0..<languages.count, id: \.self){index in
Text(languages[index].name)
}
}
看起来像这样:
我正在尝试在屏幕截图上看到的蓝色'英语'文本。到目前为止,我试图对文本和拾音器本身进行一些样式,但我无法成功。
选择器本来是菜单样式的,因此我无法将拾音器更改为另一个(即车轮)。我明确提到了它,因为当我这样做时,它有效:
Picker(languages[currentIndex].name,selection: $currentIndex){
ForEach(0..<languages.count, id: \.self){index in
Text(languages[index].name)
.font(.custom("Montserrat Medium", size:16))
}
}.pickerStyle(.wheel)
但是,这不是我想要的。我只需要为此蓝色的“英语”文本进行样式:
I have a picker like this:
Picker(languages[currentIndex].name,selection: $currentIndex){
ForEach(0..<languages.count, id: \.self){index in
Text(languages[index].name)
}
}
And it looks like this:
I'm trying to style the blue 'English' text that you see on the screenshot. So far I've tried to give some styling to the Text, and the Picker itself but I could not succeed it.
The picker is meant to be in menu style, so I can not change the pickerStyle to another one (i.e. wheel). I explicitly mentioned it because when I make it like this, it works:
Picker(languages[currentIndex].name,selection: $currentIndex){
ForEach(0..<languages.count, id: \.self){index in
Text(languages[index].name)
.font(.custom("Montserrat Medium", size:16))
}
}.pickerStyle(.wheel)
However, this is not what I'm looking for. I only need to style this blue "English" text:
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为解决方法,您可以使用
菜单
而不是picker
:As a workaround you can use
Menu
instead ofPicker
: