화면의 위쪽 절반과 아래쪽 절반의 다른 레이아웃 만 채우기 위해 맵을 가져 오려고합니다. 이제는 이것이 테이블 레이아웃과 함께 가중치를 사용하여 가능해야한다는 것을 알고 있습니다. 그러나 동일한 XML 코드 조각은 say 버튼과 완벽하게 작동하지만 맵과는 완벽하게 작동하지 않습니다.
Screenshots here.MapView를 화면 절반으로 제한
XML 코드 : 버튼을 말하여 당신이지도보기 블록을 교체 할 경우 지금은 두 번째 보이는 반면
<TableLayout
android:id="@+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<com.google.android.maps.MapView
android:id="@+id/map2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:apiKey="0_z4IHjB6EnXohnoyoudontgoVmhg"
android:clickable="true" >
</com.google.android.maps.MapView>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<Button android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="SECOND"></Button>
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<Button android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="SECOND"></Button>
</TableRow>
</TableLayout>
, 그것은, 스크린 샷의 첫 번째 이미지처럼 보이는 것 하나.
두 경우 모두 어떤 가중치 매개 변수 나 layout_width 또는 height를 변경하지 않았지만 어떻게 든 크기가 변경됩니다. 어떤 생각에서 어떻게하면 화면 절반 만 커버 할 수 있습니까?
나는 프로그래밍 방식으로하는 것이 유일한 방법이라고 생각합니다. –
그리고 어떻게 완료 될까요? – Urban
'TableLayout'과'TableRow'에서'layout_width'와'layout_height'을 사용하지 마십시오. 중첩 된 'LinearLayouts'로 전환하거나'RelativeLayout '등을 사용하십시오. – CommonsWare