如何增加 Kotlin 中的 Toast 字体大小?

How do you increase the Toast font size in Kotlin?

我在 Java 中阅读了 this article 关于更改 Toast 消息大小的内容,但是在 Kotlin 中如何完成?

答案的等效 Kotlin 代码。 Android Studio 还会自动将 Java 代码转换为 Kotlin。只需复制并粘贴即可。

为 activity 编辑:

 val toast = Toast.makeText(this,  "Text" , Toast.LENGTH_SHORT)
//the default toast view group is a relativelayout
val toastLayout = toast.getView() as ViewGroup
val toastTV =  toastLayout.getChildAt(0) as TextView
toastTV.setTextSize(30)
toast.show()