안드로이드 개발 질문/답변
(글 수 45,052)
public class Liew_Detail extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
TextView t = (TextView)findViewById(R.id.label);
t.setText("Hello"); //<= 여기서 걸림.
t.setBackgroundColor(0xFFFF0000);
t.setGravity(Gravity.LEFT);
setContentView(R.layout.view_detail);
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</RelativeLayout>
textview를 java코드에서 만드려니 에러가 뜨네요...
t.setText("Hello") 이 부분에서 걸려서 source not found 라고 뜨는데....
왜그런걸까요?




super.onCreate(savedInstanceState); 아래로 위치하세요.