2011-11-14 2 views
0

내 앱에서 mapview 개체를 사용하려고하지만 추가 정보를 동시에 표시해야합니다. 지도 아래에 일부 textviews가 있고 싶지만 전체 화면으로 확장하지 않고 mapview를 표시 할 수 없습니다. 나는 linearlayout과 relativelayout을 시도했다.Android, 화면의 일부에만 Google mapview를 만드는 방법

하단 TextView가 "google"로고 상단에 그려지는 모습을 보여주는 이미지를 첨부하고 일부를 숨 깁니다. 나는 이것을 표시해야한다. (신용이 만기되는 곳에 신용을 줘라.) 내가 알아낼 수있는 유일한 대안은지도 상단에 모든 텍스트를 넣는 것입니다.이 텍스트는 내가하고 싶지 않은 이유가 있습니다.

도움이나 트릭을 주시면 감사하겠습니다.

감사합니다,

시드 여기

내 코드

import com.google.android.maps.MapActivity; 
import com.google.android.maps.MapView; 

import android.app.Activity; 
import android.os.Bundle; 

public class maptest extends MapActivity { 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(com.isti.sms.R.layout.mapviewtest); 
     MapView mv = (MapView)this.findViewById(com.isti.sms.R.id.mapview); 

     mv.setBuiltInZoomControls(true); 
    } 
    @Override 
    protected boolean isRouteDisplayed() { 
     // TODO Auto-generated method stub 
     return false; 
    } 
} 

입니다 그리고 XML은

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/topLayout" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

<LinearLayout 
    android:id="@+id/linearLayout2" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_centerInParent="true" 
    android:orientation="vertical" > 

    <com.google.android.maps.MapView 
     android:id="@+id/mapview" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/linearLayout1" 
     android:layout_below="@+id/LabelArea" 
     android:apiKey="my long key" 
     android:clickable="true" /> 
</LinearLayout> 

<LinearLayout 
    android:id="@+id/LabelArea" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:background="#FFFFFF" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/eventinfo" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="#FFFFFF" 
     android:padding="5dip" 
     android:text="TextView" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:textColor="#0000FF" > 
    </TextView> 
</LinearLayout> 

<LinearLayout 
    android:id="@+id/linearLayout1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" > 

    <TextView 
     android:id="@+id/hrlegendtx" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_vertical" 
     android:background="#FFFFFF" 
     android:text="1 Hr" 
     android:textColor="#0000FF" /> 
</LinearLayout> 

</RelativeLayout> 

image showing bottom of map obscured

답변

0

당신은 L을 사용할 수있다 inearLayout 및 layout_weight 속성 :

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <com.google.android.maps.MapView 
     android:id="@+id/mapview" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:apiKey="my long key" 
     android:layout_weight="1" 
     android:clickable="true" /> 
    <TextView 
     android:id="@+id/hrlegendtx" 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:background="#FFFFFF" 
     android:text="1 Hr" 
     android:textColor="#0000FF" /> 
</LinearLayout> 
+0

아쉽게도 작동하지 않습니다. TextView는 보이지 않습니다. MapView 아래에 있는지 또는 화면 맨 아래에 있는지 확실하지 않습니다. 그러나 내가 얻는 것은 맵이며이 레이아웃을 가진 TextView는 없습니다. (Android 2.3, CyanogenMod7, btw) – shellman

+0

oops, TextView의 layout_height = 0dp를 0이 아닌 값으로 대체하면 작동하지 않습니다. 나는 그걸 처음으로 알지 못했다. 도와 주셔서 감사합니다! – shellman

+0

@ shellman 왜 동작이 나타나는지 모르겠지만 상대 레이아웃을 사용할 수 있습니다. textview - bottom; 지도보기에서 –

관련 문제