Java 程式碼
public class MainActivity extends AppCompatActivity { Button btn; TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn = findViewById(R.id.btn); textView = findViewById(R.id.editText); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String input = textView.getText().toString().trim(); TextView text = findViewById(R.id.result); text.setText(input); Log.d("View", input); } }); } }
以上是從輸入欄位取得文字..的詳細內容。更多資訊請關注PHP中文網其他相關文章!