2010-01-06 5 views
2

최상위 요소로 Scrollview가있는 활동이 있습니다. 내부에는 다른 뷰가 있으며 어떤 시점에는 TabHost가 있습니다. the screenshot을 보면 더 좋은 인상을받을 수 있습니다. TabHost에는 세 개의 탭이 있으며 각 탭에는 인 텐트가 실행하는 다른 활동이 있습니다.Scrollview 내부의 TabHost : 탭 클릭시 항상 아래로 스크롤

한 가지를 제외한 모든 것이 잘 작동합니다. 탭을 클릭 할 때마다 Scrollview는 자동으로 아래로 스크롤하여 over here을 볼 수 있습니다. TabHost는 나중에 화면 밖으로 나옵니다. 나는 단순히 아래로 스크롤하는 것을 원하지 않지만, 문제가 무엇인지 알 수는 없다. 1.5와 1.6 장치와 2.0 에뮬레이터에서 동일한 결과를 테스트했습니다.

<TabHost 
     android:id="@+id/tabhost" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"> 
     <LinearLayout 
      android:orientation="vertical" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content"> 
      <TabWidget 
       android:id="@android:id/tabs" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" /> 
      <FrameLayout 
       android:id="@android:id/tabcontent" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content"> 
      </FrameLayout> 
     </LinearLayout> 
    </TabHost> 

을 그리고 이것은 탭 추가하는 코드입니다 :

내 TabHost의 XML은 다음과 같습니다

private void addTab(int descriptionRes, Class<?> destination, int flags) { 
    String description = getString(descriptionRes); 
    TabSpec spec = mTabHost.newTabSpec(description); 
    spec.setIndicator(description); 
    Intent i = new Intent(this, destination); 
    i.setData(Uri.parse(member.getId())).setFlags(flags); 
    spec.setContent(i); 
    mTabHost.addTab(spec); 
} 

어떤 제안?

+0

이것은 오래된 질문이지만 유사한 문제로 어려움을 겪고있는 사람이라면 누구나 해결책을 찾아 볼 수 있습니다. http://stackoverflow.com/a/10442368/56285 – Jonik

답변

0

당신은 설정을 시도 할 수있는 Activity 내부의 TabHost로 스크롤, 오히려 최상위 Activity 자체보다.

관련 문제