package com.android.textview3;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.graphics.Color;

public class TextViewDemo3 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        //main.xml 등록
        setContentView(R.layout.main);
        
        //사전에 등록한id를 통해 TextView객체 호출
        TextView text =(TextView)findViewById(R.id.text);
        text.setBackgroundColor(Color.BLUE);
        text.setTextColor(Color.WHITE);
        
    }
}
/* AUTO-GENERATED FILE.  DO NOT MODIFY.
 *
 * This class was automatically generated by the
 * aapt tool from the resource data it found.  It
 * should not be modified by hand.
 */

package com.android.textview3;

public final class R {    //상속불가
    public static final class attr {
    }
    public static final class drawable {
        public static final int ic_launcher=0x7f020000;
    }
    public static final class id {
        public static final int text=0x7f050000;
    }
    public static final class layout {
        public static final int main=0x7f030000;
    }
    public static final class string {
        public static final int app_name=0x7f040001;
        public static final int hello=0x7f040000;
    }
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/text"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

</LinearLayout>



'Android > 기본' 카테고리의 다른 글

Android 간단한 이벤트2  (0) 2012.04.28
Android 간단한 이벤트  (0) 2012.04.28
android 기본 (TextView)2 - 객체를 직접입력하는 방법  (0) 2012.04.28
android 기본 (TextView)  (0) 2012.04.28
Android Program Structure  (0) 2012.04.28

+ Recent posts