2012-11-12 45 views
2

我有一个使用自定义下拉样式界面的应用程序。由于解释有些复杂的原因,我不得不使用内置的Android微调来代替它。溢出UI布局

我遇到了一个问题,让下拉选项(橙色)重叠我打开的对话框(绿色)。当下拉未打开时,fill_parent会使绿色部分过大,并且将其设置得太小会在绿色对话框区域后面留下黑色区域,与填充父区时的大小相同。

有没有办法达到这种布局?

enter image description here

相反,它显示了这样的: enter image description here

<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/rl_root" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

    <View 
     android:id="@+id/vw_background" 
     android:layout_width="fill_parent" 
     android:layout_height="180dip" 
     android:background="#FFFFFF"/> 

    <RelativeLayout 
     android:id="@+id/rl_stacker" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:padding="10dip"> 

     <TextView 
      android:id="@+id/tv_question" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:text="@string/sample_prompt_message" 
      android:textColor="#000000" 
      android:textSize="18dp" 
      android:padding="10dip"/> 

     <TextView 
      android:id="@+id/tv_dropdown_closed" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/tv_question" 
      android:gravity="center_vertical|left" 
      android:text="@string/request_control_dropdown_option_1" 
      android:textColor="#000000" 
      android:background="@drawable/background_dropdown" 
      android:layout_marginLeft="3dip" 
      android:layout_marginRight="3dip" 
      android:layout_marginTop="0dip" 
      android:layout_marginBottom="5dip" 
      android:paddingLeft="10dip"/> 

     <LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/ll_buttons" 
      android:orientation="horizontal" 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:layout_below="@id/tv_dropdown_closed"> 

      <trioro.voyeur.ui.GhostButton 
       android:id="@+id/gb_yes" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/button_yes"/> 

      <trioro.voyeur.ui.GhostButton 
       android:id="@+id/gb_no" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:text="@string/button_no" /> 

     </LinearLayout> 





     <LinearLayout 
      android:id="@+id/ll_dropdown_open" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/tv_question" 
      android:layout_marginBottom="0dip" 
      android:layout_marginLeft="3dip" 
      android:layout_marginRight="3dip" 
      android:layout_marginTop="0dip" 
      android:background="#CCCCCC" 
      android:gravity="center" 
      android:orientation="vertical" 
      android:paddingBottom="1dip" 
      android:paddingLeft="1dip" 
      android:paddingRight="1dip" 
      android:paddingTop="0dip" 
      android:visibility="invisible" > 

      <TextView 
       android:id="@+id/tv_dropdown_option_1" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/request_control_dropdown_option_1" 
       android:textColor="#000000" 
       android:padding="10dip" 
       android:background="#FFFFFF" 
       android:layout_marginTop="1dip" /> 

      <TextView 
       android:id="@+id/tv_dropdown_option_2" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/request_control_dropdown_option_2" 
       android:textColor="#000000" 
       android:padding="10dip" 
       android:background="#FFFFFF" 
       android:layout_marginTop="1dip" /> 

      <TextView 
       android:id="@+id/tv_dropdown_option_3" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/request_control_dropdown_option_3" 
       android:textColor="#000000" 
       android:padding="10dip" 
       android:background="#FFFFFF" 
       android:layout_marginTop="1dip" /> 

      <TextView 
       android:id="@+id/tv_dropdown_option_4" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:text="@string/request_control_dropdown_option_4" 
       android:textColor="#000000" 
       android:padding="10dip" 
       android:background="#FFFFFF" 
       android:layout_marginTop="1dip" /> 

     </LinearLayout> 

    </RelativeLayout> 

</RelativeLayout> 
+0

图像正在发生什么,或者你想要发生什么? – jcw

+0

我想要发生什么。我已经为发生的事情添加了一些标记和图像 – raydowe

回答

2

尝试使用LayoutParams.TYPE_APPLICATION_PANEL为你弹出列表窗口。 对不起,我不能没有看到实际的代码更具体。