2012-11-14 3 views
3

어떻게 HorizontalScrollView를 오른쪽에서 왼쪽 방향으로 동작하도록 설정합니까? 기본 동작은 표시된 첫 번째 탭 (기본 탭)이 왼쪽에서 오는 것입니다. 탭을 역순으로 정렬하여 첫 번째 '기본'탭이 화면의 오른쪽에 오도록하십시오.안드로이드를 설정하는 방법 HorizontalScrollView 오른쪽에서 왼쪽 동작 (왼쪽이 아닌 오른쪽에서 기본 선택된 탭)

어떻게하면됩니까? 나는 layout_gravity를 사용했지만 작동하지 않았다 .. 여기

가 tabhost와 HorizontalScrollView 포함, 내 레이아웃 코드 :

<TabHost xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@android:id/tabhost" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <HorizontalScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:fillViewport="true" 
     android:scrollbars="none"> 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 
    </HorizontalScrollView> 

    <FrameLayout 
     android:id="@android:id/tabcontent" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 
</LinearLayout> 

</TabHost> 
+1

'HorizontalScrollView'에는 탭이 없습니다. – CommonsWare

답변

2

한 가지 해결 방법 작동합니다

final HorizontalScrollView view = (HorizontalScrollView) findViewById(R.id.scroller); 
     view.postDelayed(new Runnable() { 

      @Override 
      public void run() { 
       view.fullScroll(HorizontalScrollView.FOCUS_RIGHT); 
      } 
     }, 10); 

아이디어를 프로그래밍 방식의 스크롤링이 작동하려면 지연이 필요하다는 것입니다.

관련 문제