2011-10-04 44 views
0

我在我的应用程序中有一个mapview。 我已经在相对布局中设置了294x322 imgage,并且在相关布局中,我添加了mapview和wrap_conten作为高度,并且wight认为地图视图还将包含helay的大小和weightlay的重量294x322。但是在运行时,我的mapview会去填充parent.one我发现的解决方案是给背景图像的相对布局的静态高度宽度,但问题是我有两个同名的图像,我已经在hdpi和mdpi文件夹中输入,所以它不适用于多屏幕资源。mapview去填充父代而不是换行内容

这里I M加入我的XML文件

<!-- MapView --> 

      <RelativeLayout 

        android:id="@+id/layout_mapRestaurant" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@id/rlBtnView" 
        android:layout_centerHorizontal="true" 
        android:paddingLeft="15dip" 
        android:paddingTop="15dip" 
        android:paddingRight="15dip" 
        android:paddingBottom="40dip" 
        android:layout_marginTop="-25dip" 
        android:background="@drawable/mapbg" 

        > 
           <com.google.android.maps.MapView 

        xmlns:android="http://schemas.android.com/apk/res/android" 
        android:id="@+id/mapview_SearchResult" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:clickable="true" 
        android:background="@drawable/bg_border" 

       /> 

    </RelativeLayout> 

以下是我如我设计

enter image description here

以下是其中I M在运行时显示实际布局图形布局。 enter image description here

谁能告诉我如何从这个问题出来?????

回答

0

为了调整垂直方向2个布局我使用的“高度= 0dp”和“权重= 1”,为我正常工作之间的MapView:

<com.google.android.maps.MapView 
    android:id="@+id/mapview" 
    android:layout_width="fill_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:clickable="true" 
    android:apiKey="xxxxxxxxxxxxxxxxxxxxxxxxxxxx" 
/>