究竟是EditText.text回来?

问题描述 投票:-2回答:1
<EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="textPersonName"
        android:ems="10"
        android:id="@+id/player_name"
        android:hint="Name"/>

为了让我的EditText的文本,我需要如下图所示,以toString()添加到末尾。但究竟是什么player_name.text返回?

val name: String = player_name.text.toString()
android kotlin
1个回答
0
投票

正如@Mike M.指示,则返回一个Editable

getText

open fun getText(): Editable!

EditText - Android Developers

© www.soinside.com 2019 - 2024. All rights reserved.