如何放置一个RelativeLayout的在RelativeLayout的底部?RelativeLayout

2023-09-06 22:30:26 作者:陌沫

我有一个 RelativeLayout的,而这种布局有两个孩子的,一个是图形页面,另一个是 RelativeLayout的,其中包含一个按钮。

I have a RelativeLayout, and this Layout has two childs, one is a MapView and the other a RelativeLayout that contains a button.

我希望它看起来像

但我的透明包装盒(一个 RelativeLayout的)始终显示在地图顶部。

but my transparent box (a RelativeLayout) is always displayed at the top of the map.

<RelativeLayout 
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">

  <com.google.android.maps.MapView
    android:id="@+id/mapView"/>

    <test.project.TransparentPanel 
      android:layout_width="fill_parent"
      android:layout_width="fill_parent">   

        <Button 
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Click Me!"/>   

    </test.project.TransparentPanel>

</RelativeLayout>   

(我已经留下了一些东西,在code)

(i've left out some things in the code)

推荐答案

尝试添加alignParentBottom选择透明面板。

Try adding a alignParentBottom option to the transparent panel.

<RelativeLayout 
  android:layout_width="wrap_content"
  android:layout_height="wrap_content">

  <com.google.android.maps.MapView 
    android:id="@+id/mapView"/>

  <test.project.TransparentPanel
    android:layout_width="fill_parent"
    android:layout_width="fill_parent"
    android:layout_alignParentBottom="true">

      <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Click Me!"/>         

  </test.project.TransparentPanel>

</RelativeLayout> 
 
精彩推荐
图片推荐