2012-10-31 8 views
3

FrameLayout에 ScrollView가 있습니다. ScrollView에는 단일 자식 LinearLayout이 있습니다. 이 LinearLayout에 ImageViews를 프로그래밍 방식으로 추가하고 있습니다. 내가 scrollview 가로로 스크롤 싶어요.ScrollView가 스크롤하지 않습니다.

<FrameLayout 
         android:id="@+id/imgScroll" 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:background="@drawable/avatar_block"> 

         <ScrollView 
          android:id="@+id/avatarScrollView" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:layout_gravity="center" 
          android:fillViewport="true"> 

          <LinearLayout 
           android:id="@+id/scrollLayout" 
           android:layout_width="wrap_content" 
           android:layout_height="wrap_content" 
           android:gravity="left"> 


          </LinearLayout> 
         </ScrollView> 

         <RelativeLayout 
         android:layout_width="match_parent" 
          android:layout_height="match_parent"> 
            <!-- 2 ImageViews --> 
         </RelativeLayout> 
    </FrameLayout> 

이 내가

LinearLayout inScrollLayout = (LinearLayout) findViewById(R.id.scrollLayout); 
for(int i = 0; i < imgArray.length; i++) 
{ 
    ImageView imgView = new ImageView(this); 
    imgView.setImageResource(R.drawable.icon); 
    imgView.setPadding(0, 0, 40, 0); 
    inScrollLayout.addView(imgView); 
} 

ImageViews 레이아웃에 추가 (현재 드로어 블에 이미지를 하드 코딩) ImageViews를 추가하고 있지만, 마지막 이미지가 크기이고 내가 스크롤 할 수 없습니다 축소하는 방법입니다.

+1

높이는 wrap_content – njzk2

+0

또는 dp 값을 설정하는 대신 match_parent 여야합니다. 스크롤 가능한보기를 wrap_content로 설정하면 안됩니다. – AedonEtLIRA

답변

관련 문제