2012-01-06 4 views
0

나는 그것이 여기에 짜증나는 플러그인이라고 생각한다. 일식에서 풍경보기로 전환하면 다음과 같은 결과를 얻습니다. http://img718.imageshack.us/img718/1239/landscape1je.jpg가로보기 문제 (레이아웃 디버그 방법)

물론 일반적인 4 인치 화면을 염두에 두지 않습니다. 따라서 ScrollView가 일식에서 어떻게 작동하는지 확인하는 방법은 없습니다.

좋아요, 그래서 앱을 전화로 보냅니다. 여기에 문제가 있습니다. 내가 전화를 프리젠 테이션으로 바꿀 때 나는 이것을 얻는다 : http://imageshack.us/photo/my-images/718/landscape3x.jpg/

그리고 이것은 내가 얻을 수있는 최고 스크롤이다. 이 이미지는 스크롤 영역을 보여줍니다. http://img849.imageshack.us/img849/2774/landscape2y.jpg

그리고 이것은 내 xml 코드입니다. 나는 시도하고 실수를하지만, 모든 시간이 정말 오래하게 전화에 응용 프로그램을 전송의 일반적인 방법으로 할 것 :/어쩌면 내가 빨리 여기

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_gravity="center" 
    android:layout_margin="30dip" 
    android:orientation="vertical" > 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" > 

     <Button 
      android:id="@+id/add_income" 
      android:layout_width="120dip" 
      android:layout_height="120dip" 
      android:layout_margin="15dip" 
      android:drawableTop="@drawable/icon_income" 
      android:text="@string/income" > 
     </Button> 

     <Button 
      android:id="@+id/add_expense" 
      android:layout_width="120dip" 
      android:layout_height="120dip" 
      android:layout_margin="15dip" 
      android:drawableTop="@drawable/icon_expense" 
      android:text="@string/expense" > 
     </Button> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/linearLayout2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" > 

     <Button 
      android:id="@+id/categories" 
      android:layout_width="120dip" 
      android:layout_height="120dip" 
      android:layout_margin="15dip" 
      android:drawableTop="@drawable/icon_category" 
      android:text="@string/categories" > 
     </Button> 

     <Button 
      android:id="@+id/summary" 
      android:layout_width="120dip" 
      android:layout_height="120dip" 
      android:layout_margin="15dip" 
      android:drawableTop="@drawable/icon_summary" 
      android:text="@string/summary" > 
     </Button> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center" > 

     <Button 
      android:id="@+id/charts" 
      android:layout_width="120dip" 
      android:layout_height="120dip" 
      android:layout_margin="15dip" 
      android:drawableTop="@drawable/icon_charts" 
      android:text="@string/charts" > 
     </Button> 

     <Button 
      android:id="@+id/bug_list" 
      android:layout_width="120dip" 
      android:layout_height="120dip" 
      android:layout_margin="15dip" 
      android:drawableTop="@drawable/icon_bug" 
      android:text="@string/bugs" > 
     </Button> 
    </LinearLayout> 
</LinearLayout> 

+0

가로 방향으로이 xml을 별도로 디자인하고 레이아웃 랜드 폴더에 배치 했습니까? 그리고 네, 평소와 같이 스크롤하는 것을 테스트 할 수 있습니다. 그냥 스크롤하십시오. 그것은 나를 위해 일했다. – Ghost

+0

첫 번째 이미지 링크가 작동하지 않습니다 ... – WarrenFaith

+0

별도로 디자인하지 않았습니다. 나는 이것에 대해 몰랐다. 첫 번째 이미지가 보여 주듯이 스크롤 할 내용이 없습니다 (링크를 수정했습니다). –

답변

1

에서 일부 도움을받을 수 있습니다 그 경우 (코멘트 대신 여기에 답변으로 추가), 가로 모드에 대해 레이아웃을 개별적으로 디자인하고 해당 레이아웃을 res/layout-land에 배치해야합니다. 그러나 레이아웃에 대한 이름 지정 규칙은 동일해야합니다. 예 : setContentView(R.layout.main);은 기본적으로 portrait layout을로드합니다. 휴대 전화를 켜서 landscape layout이 나타나면 android가 layout-land 폴더에서 자동으로 XML을 가져옵니다. 따라서 setContentView(R.layout.main);은이 폴더에서 xml을로드합니다. 레이아웃 자체를 디자인 할 때는 그래픽 편집기를 landscape 모드로 나타나게하여 디자인하기 쉽도록해야합니다. 이 시도.

+0

멋지지만 여전히 가로 레이아웃에 대한 적절한 미리보기가 없습니다. 첫 번째 스크린 샷과 같습니다 :/ –

+1

상대 레이아웃 사용해보기. 보통 도움이됩니다. 그리고 한 가지 더 - 풍경 버전을 디자인 할 때 디자인 측면을 염두에 두십시오. – Ghost

+0

네가 맞아, 지금 적절한 해결책을 얻었 어. 글쎄, 여전히 스크롤 할 수는 없지만 어딘가에 갈 것입니다. –