package dae.micro;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
public class micro extends Activity {
View mPage1, mPage2, mPage3;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mPage1 = findViewById(R.id.page1);
mPage2 = findViewById(R.id.page2);
mPage3 = findViewById(R.id.page3);
findViewById(R.id.btnpage1).setOnClickListener(mClickListener);
findViewById(R.id.btnpage2).setOnClickListener(mClickListener);
findViewById(R.id.btnpage3).setOnClickListener(mClickListener); <=이쪽에서만 오류
}
Button.OnClickListener mClickListener = new Button.OnClickListener(){
public void onClick(View v){
mPage1.setVisibility(View.INVISIBLE);
mPage2.setVisibility(View.INVISIBLE);
mPage3.setVisibility(View.INVISIBLE);
switch(v.getId()){
case R.id.btnpage1:
mPage1.setVisibility(View.VISIBLE);
break;
case R.id.btnpage2:
mPage2.setVisibility(View.VISIBLE);
break;
case R.id.btnpage3:
mPage3.setVisibility(View.VISIBLE);
break;
}
}
};
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/btnpage1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="page 1"
/>
<Button
android:id="@+id/btnpage2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="page 2"
/>
<Button
android:id="@+id/btnpage3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="page 3"
/>
</LinearLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/page1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffff00"
android:orientation="vertical"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="첫번째"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
/>
</LinearLayout>
<RelativeLayout
android:id="@+id/page2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:background="#00ff00"
>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="botton"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="botton"
/>
</RelativeLayout>
<TableLayout
android:id="@+id/page3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="invisible"
android:background="#0000ff"
>
<TableRow>
<TextView android:text="1" android:textSize="15pt" android:padding="10px"/>
<TextView android:text="2" android:textSize="15pt" android:padding="10px"/>
<TextView android:text="3" android:textSize="15pt" android:padding="10px"/>
</TableRow>
<TableRow>
<TextView android:text="4" />
<TextView android:text="5" />
<TextView android:text="6" />
</TableRow>
</TableLayout>
</FrameLayout>
</LinearLayout>
책의대한예제를 연습하는중에 정말 오류를 못잡아내고있어여 ㅠ어디서 오류가 나는지도 알고있는데
뭐가 틀린건가여? ㅠ