-1

XMLにこのテキストビューがあります

    <TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="85dp"
    android:text="@string/text"
    android:textAppearance="?android:attr/textAppearanceLarge" />

私が書いているJavaメソッドからこれを操作できるようにしたいです。これは私の最初のAndroidアプリなので、よくわかりません。私はあなたが使用できることを読みました

t=(TextView)findViewById(R.id.TextView01); 
t.setText("new text");

ただし、Eclipseは、テキストビューをタイプに解決できないと言っています。何かをインポートする必要がありますか?

4

3 に答える 3

2
 t=(TextView)findViewById(R.id.textView1); 

Textviewクラスをインポートするだけです:

  if you are using eclipse:  ctrl+shift+O
于 2013-09-06T20:12:53.370 に答える