我有一个linearLayout
,在map.xml
中描述如下。其中有fragment
, view
和linearLayout "map_below"
。是否有可能实现fragment
, view
和linearLayout
,以便fragment
和linearLayout
"map_below"
的高度将以编程方式配置?map_below linearLayout
包含所有标记的标题的Text View
,以便让用户知道哪些标记显示在Google地图中。
我认为问题在于必须显示地图以设置其中的标记,并且必须定义地图高度。因此,map_below linearLayout
获得其余的屏幕高度。目前我面临的问题是显示map_below
中的所有标题,因为fragment
具有500dp
的有限高度。我可以设置fragment
和map_below
的高度编程吗?
map.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<fragment
android:layout_width="match_parent"
android:layout_height="500dp"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#181407"/>
<LinearLayout
android:id="@+id/map_below"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#303230"/>
</LinearLayout>
<LinearLayout
android:id="@+id/ll_map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/tendp"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</fragment>
<ImageButton
android:id="@+id/btn_getdirection"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignBottom="@id/map"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/fivedp"
android:background="@color/white"
android:src="@drawable/mapdirection" />
<TextView
android:id="@+id/txt_dictance"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/fivedp"
android:layout_toLeftOf="@id/btn_getdirection"
android:background="@color/white"
android:gravity="center"
android:textColor="#616161" />
<TextView
android:id="@+id/txt_direction"
android:layout_width="60dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/fivedp"
android:layout_toRightOf="@id/btn_getdirection"
android:background="@color/white"
android:gravity="center|left"`enter code here`
android:text="Direction"
android:textColor="#616161" />
</RelativeLayout>
</LinearLayout>