本文介绍了如何在JavaFX中为TextArea设置圆角?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在TextArea上加上圆角,但是看起来有点奇怪.似乎,一些内层也应该具有相同半径的圆角,但是哪一个呢?

I need to have rounded corners on TextArea, but it looks a bit weird. Seems, some inner layer should also have rounded corners with the same radius, but which one?

我使用以下CSS:

.text-area {
    -fx-background-color: #dbb1b1, #fff0f0;
    -fx-background-radius: 15;
    -fx-border-radius: 15;
    -fx-border-color: red;
}

看起来像这样: TextArea角点

推荐答案

似乎我需要发布此问题才能自己找到解决方案:D

Seems I was needed to post this question in order to find solution by myself :D

.text-area .scroll-pane {
    -fx-background-color: transparent;
}
.text-area .scroll-pane .viewport{
    -fx-background-color: transparent;
}
.text-area .scroll-pane .content{
    -fx-background-color: transparent;
}

这篇关于如何在JavaFX中为TextArea设置圆角?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 09:05