안드로이드 개발 질문/답변
(글 수 45,052)
탭1 탭2 탭3 탭4
가 있을 떄
처음에 에뮬레이터에서 탭1의 이미지를 스크롤 하면 잘 됩니다.
그리고 탭2의 이미지를 스크롤 하면 잘 됩니다.
그리고 다시 탭1로 가면 이미지 스크롤이 되지 않습니다.
스크롤 바는 왔다갔다 하는데 이미지는 그대로있네요..
결국 탭1부터 탭4까지 전부 테스트 해보면 탭4만 이미지 스크롤이 가능 해 집니다.
혹시 무슨 문제가 있나 해서 소스를 올려봅니다.
많이 가르쳐주세요..
tab.xml파일입니다.
tab.java 파일입니다.
가 있을 떄
처음에 에뮬레이터에서 탭1의 이미지를 스크롤 하면 잘 됩니다.
그리고 탭2의 이미지를 스크롤 하면 잘 됩니다.
그리고 다시 탭1로 가면 이미지 스크롤이 되지 않습니다.
스크롤 바는 왔다갔다 하는데 이미지는 그대로있네요..
결국 탭1부터 탭4까지 전부 테스트 해보면 탭4만 이미지 스크롤이 가능 해 집니다.
혹시 무슨 문제가 있나 해서 소스를 올려봅니다.
많이 가르쳐주세요..
tab.xml파일입니다.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ScrollView android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageView1"
android:src="@drawable/wayone"
android:scaleType="fitCenter"
></ImageView>
</ScrollView>
<ScrollView android:id="@+id/ScrollView02"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageView2"
android:src="@drawable/way2"
android:scaleType="fitCenter"></ImageView>
</ScrollView>
<ScrollView android:id="@+id/ScrollView03"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageView3"
android:src="@drawable/waythree"
android:scaleType="fitCenter"></ImageView>
</ScrollView>
<ScrollView android:id="@+id/ScrollView04"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/imageView4"
android:src="@drawable/wayfour"
android:scaleType="fitCenter"></ImageView>
</ScrollView>
</FrameLayout>tab.java 파일입니다.
package my.Tab;
import android.app.TabActivity; import android.os.Bundle; import android.view.LayoutInflater; import android.widget.TabHost; //import my.Tab.android.apis.R;
public class Tab extends TabActivity {
/** Called when the activity is first created. */
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TabHost tabHost=getTabHost();//setContentView(R.layout.main);
LayoutInflater.from(this).inflate(R.layout.tab,tabHost.getTabContentView(),true);
tabHost.addTab(tabHost.newTabSpec("tab1")
.setIndicator("1방면") //ID
.setContent(R.id.imageView1));
tabHost.addTab(tabHost.newTabSpec("tab2")
.setIndicator("2방면") //ID
.setContent(R.id.imageView2));
tabHost.addTab(tabHost.newTabSpec("tab3")
.setIndicator("3방면") //ID
.setContent(R.id.imageView3));
tabHost.addTab(tabHost.newTabSpec("tab4")
.setIndicator("4방면") //ID
.setContent(R.id.imageView4));
}
}


