2011-04-22 4 views
1

Xoom Tablet의 레이아웃에 문제가 있습니다. 기본적으로, 하나의 조각 (ListView) 왼쪽 및 ListView 조각 바로 다른 조각 싶습니다. 그러나 이것에 대해 두 가지 문제가 있습니다.Xoom Tablet의 상대 레이아웃 문제

먼저, 200dip (아래 코드 참조)으로 설정된 listview 조각에 대해 android : layout_width를 하드 코딩하고 싶지 않습니다. wrap_content, fill_parent 시도했지만 그것은 나를 위해 일을 못했습니다.

둘째,이 UI는 전체 화면에 렌더링되지 않습니다. 그것만이 전체 태블릿 화면의 작은 부분을 캡처합니다. fill_parent에서 다른 값으로의 하드 코딩조차도 효과가 없습니다.

코드는 다음과 같습니다. 이 문제에 대한 도움을 주시면 감사하겠습니다.

~ 감사합니다.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <fragment class="com.example.android.apis.app.FragmentLayout$TitlesFragment" 
     android:id="@+id/titles" android:layout_width="200dip" 
     android:layout_alignParentLeft="true" 
     android:layout_height="match_parent" /> 

    <FrameLayout android:id="@+id/details" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_alignParentRight="true" 
     android:layout_toRightOf="@id/titles" 
     android:background="?android:attr/detailsElementBackground" /> 
</RelativeLayout> 

답변

1

하드 코딩 대신 각 프레임 레이아웃의 레이아웃 가중치를 설정할 수 있습니다.

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <FrameLayout 
    android:id="@+id/items_layout" 
    android:layout_weight="1" 
     android:layout_width="0px" 
     android:layout_height="match_parent" 
     android:background="?android:attr/detailsElementBackground" /> 

    <FrameLayout 
    android:id="@+id/details_layout" 
    android:layout_weight="2" 
     android:layout_width="0px" 
     android:layout_height="match_parent" 
     android:background="?android:attr/detailsElementBackground" /> 

확실하지 않음 즉

은 왜 UI가 전체 화면을 차지하지 않습니다. largeScreens를 지원하고 있습니까, 매니페스트에 설정이 있습니다.

<supports-screens 
    android:resizeable="true" 
    android:smallScreens="true" 
    android:normalScreens="true" 
    android:largeScreens="true" 
    android:anyDensity="true"> 
</supports-screens> 
+0

답장을 부탁드립니다. – user720986