2011-10-09 6 views
0

동적 뷰 (3-6)의 숫자가 포함 된 동적 페이지 번호 (1-3)가있는 사용자 정의보기를 만들려고합니다. 페이지는 실제로 정의되지 않으며 하위 뷰의 가상 그룹입니다. 한 페이지가 화면 너비에 맞습니다.Android Custom View Spacing

제 문제는 child.setMinimumWidth(screenWidth/mChildrenPerPage)을 사용하지 않고 아이들을 똑같이 배치 할 수 없다는 것입니다.하지만 너무 높아집니다. 어떻게 그들을 원래의 높이로 유지하고 평등하게 놓을 수 있습니까? 여기 내 코드는

mIconWidth = screenWidth/mChildrenPerPage; 

    for (int i = 0; i < mPages; i++) { 
     for (int j = 0; j < mChildrenPerPage; j++) { 
      View icon = layoutInflater.inflate(R.layout.child, this, false); 

      ((ImageView)icon).setImageDrawable(resources.getDrawable(R.drawable.some_icon)); 
      icon.setMinimumWidth(mIconWidth); 
      addView(icon); 
     } 
    } 

답변

0

나는 레이아웃을 설정하고 layout_weight를 수동으로 설정해야했다.