android.widget.TextView を使用します。
TextViewを使ったサンプル
■ソースコード
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.text_layout);
  // チェックボックスをクリックした場合のイベントを設定
  findViewById(R.id.sample_text).setOnClickListener(this);
}
@Override
public void onClick(View view) {
    if (view.getId() == R.id.sample_text) {
        // テキストを変更
        ((TextView)view).setText("変更されたテキスト");
    }
}
■レイアウト
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:padding="0dp" >
    <TextView
        android:id="@+id/sample_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="テキストさんぷる" />
</FrameLayout>
 
 
 
 
 
 
0 件のコメント:
コメントを投稿