2012-09-23 33 views
0

我没有得到这个布局thingy正确。安卓LinearLayout填写比父母更多

这里有一些图片,使之easies我解释:

enter image description here

绿色的东西是临时图标SlidingDrawer。正如你所看到的,我希望它能够完成到另一个灰色区域,这样灰色背景变成了一个,并且处理程序图标与顶部区域重叠。

这是XML怎么看起来像现在:

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

    <LinearLayout 
     android:id="@+id/info_container" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/drawer_bg" 
     android:orientation="vertical" 
     android:paddingBottom="5dip" 
     android:paddingLeft="10dip" 
     android:paddingRight="10dip" 
     android:paddingTop="10dip" > 

     <TextView 
      android:id="@+id/info_ip" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textSize="10dip" 
      android:typeface="monospace" /> 

     <TextView 
      android:id="@+id/info_in" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/wifi_unknown" 
      android:textSize="10dip" 
      android:typeface="monospace" /> 

     <TextView 
      android:id="@+id/info_mo" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textSize="10dip" 
      android:typeface="monospace" /> 
    </LinearLayout> 

    <FrameLayout 
     android:layout_width="fill_parent" 
     android:layout_height="0dip" 
     android:layout_weight="1" > 

     <TextView 
      android:id="@+id/list_empty" 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:layout_gravity="center_horizontal" 
      android:gravity="center_vertical" 
      android:text="@string/discover_empty" 
      android:textSize="10dip" 
      android:typeface="monospace" /> 

     <!-- Slider --> 
     <SlidingDrawer 
      android:id="@+id/drawer" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:content="@+id/content" 
      android:handle="@+id/handle" > 

      <!-- Image for the handler to the slider --> 
      <ImageView 
       android:contentDescription="@string/desc" 
       android:id="@id/handle" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:src="@drawable/drawer_handle" /> 

      <LinearLayout 
       android:id="@id/content" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:background="@drawable/slider_bg" 
       android:orientation="vertical" > 

       <!-- Horisontal layout : wide as possible, but height is minimal --> 
       <LinearLayout 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_margin="5dip" 
        android:orientation="horizontal" > 

        <!-- Search button --> 
        <Button 
         android:id="@+id/btn_discover" 
         style="@style/ButtonTop" 
         android:drawableLeft="@drawable/discover" 
         android:text="@string/btn_discover" /> 

        <!-- Option button --> 
        <Button 
         android:id="@+id/btn_options" 
         style="@style/ButtonTop" 
         android:drawableLeft="@drawable/settings" 
         android:text="@string/btn_options" /> 
       </LinearLayout> 

       <!-- The list with network devices inside the slidingdrawer--> 
       <ListView 
        android:id="@+id/output" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:cacheColorHint="#00000000" 
        android:dividerHeight="0dip" /> 
      </LinearLayout> 
     </SlidingDrawer> 
    </FrameLayout> 
</LinearLayout> 

我用尽RelativeLayout的,但我不能得到它的权利。 对不起,我的坏解释。

回答

2

如果您希望将信息窗格与滑动抽屉重叠,则它(信息窗格layiut)需要位于framelayout内。

这个简单的改变应该使它像你想要的那样工作。

+0

哇,工作! – rtc11