분명히 코드짤때 오류가 없었는데 자꾸 ForceClose가 뜨네요..
속상합니다.
혹시 코드 좀 봐주실수 있을까요
탭위젯 연습하는데 너무 힘듭니다.ㅎㅎ
//-----------------------------------------------------------// 메인
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab3"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="70dip"
>
<Button
android:id="@+id/startFAButtonId"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="작동/멈춤" />
<ImageView android:id="@+id/imageView"
android:layout_below="@id/startFAButtonId"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
</FrameLayout>
</TabHost>
//-----------------------------------------------------------// 자바파일
package my.SM;
import java.io.IOException;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TabHost;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.media.MediaPlayer;
import android.widget.Toast;
public class SM extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost tabs=(TabHost)findViewById(R.id.tabhost);
tabs.setup();
TabHost.TabSpec
spec=tabs.newTabSpec("tag1");
spec.setContent(R.id.tab1);
spec.setIndicator("Intro..");
tabs.addTab(spec);
spec=tabs.newTabSpec("tag2");
spec.setContent(R.id.tab2);
spec.setIndicator("About");
tabs.addTab(spec);
spec=tabs.newTabSpec("tag3");
spec.setContent(R.id.tab3);
spec.setIndicator("Start");
tabs.addTab(spec);
this.setupButton();
}
private void setupButton()
{
Button b = (Button)this.findViewById(R.id.startFAButtonId);
b.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v)
{
parentButtonClicked(v);
}
});
}
private void parentButtonClicked(View v)
{
animate();
}
private void animate()
{
ImageView imgView = (ImageView)findViewById(R.id.imageView);
imgView.setVisibility(ImageView.VISIBLE);
imgView.setBackgroundResource(R.drawable.frame_animation);
AnimationDrawable frameAnimation =
(AnimationDrawable) imgView.getBackground();
if (frameAnimation.isRunning())
{ frameAnimation.stop(); }
else
{
frameAnimation.stop();
frameAnimation.start();
} }
protected void onPause() {
super.onPause();
}
}
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:id="@+id/tab1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/logo1"
/>
//---------------------------------------------------------------
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab2"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="70dip">
<TextView android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dip"
android:text=" 속상해요 ㅎㅎㅎ"/>
</RelativeLayout>
//-----------------------------------------------------------//
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tab3"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="70dip"
>
<Button
android:id="@+id/startFAButtonId"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="작동/멈춤" />
<ImageView android:id="@+id/imageView"
android:layout_below="@id/startFAButtonId"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
</FrameLayout>
</TabHost>



