2012-06-08 93 views
0

我已尝试所有可能的选项android:backgroundandroid:cacheColorHint@android:color/transparent@null但没有用于隐藏图片中的listView。ListView不占用整个屏幕

我想合并灰色背景(粉红色问号)与我的应用程序的白色主题。

我的主题是正规@android:style/Theme.Light.NoTitleBar

我的布局代码是

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@android:color/transparent" > 

    <LinearLayout 
     android:id="@+id/header" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:weightSum="1" > 

     <ImageView 
      android:id="@+id/abcIcon" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical|center_horizontal" 
      android:layout_weight="0.15" 
      android:contentDescription="@string/abcIcon" 
      android:scaleType="centerInside" 
      android:src="@drawable/abc" /> 

     <TextView 
      android:id="@+id/title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical|center_horizontal" 
      android:layout_weight="0.70" 
      android:text="@string/app_name" 
      android:textSize="@dimen/headertextsize" /> 

     <ImageView 
      android:id="@+id/search" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical|center_horizontal" 
      android:layout_weight="0.15" 
      android:contentDescription="@string/abcIcon" 
      android:src="@drawable/search" /> 
    </LinearLayout> 

    <RelativeLayout 
     android:id="@+id/followupHeaderLayout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/header" 
     android:layout_gravity="center_horizontal" > 

     <RelativeLayout 
      android:id="@+id/followupHeaderRelativeLayout" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="10dp" > 

      <ImageView 
       android:id="@+id/leftArrow" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:contentDescription="@string/abcIcon" 
       android:src="@drawable/leftarrow" /> 

      <TextView 
       android:id="@+id/followupHeaderText" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@id/leftArrow" 
       android:text="@string/followup" 
       android:textSize="@dimen/headertextsize" /> 
     </RelativeLayout> 

     <TextView 
      android:id="@+id/followupDescriptionText" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/followupHeaderRelativeLayout" 
      android:layout_centerInParent="true" 
      android:padding="10dp" 
      android:text="@string/followupdescription" 
      android:textSize="@dimen/normaltextsize" /> 
    </RelativeLayout> 

    <TextView 
     android:id="@+id/listViewHeaderText" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/followupHeaderLayout" 
     android:layout_marginLeft="10dp" 
     android:text="@string/typeofAppt" 
     android:textSize="@dimen/normaltextsize" /> 

    <RelativeLayout 
     android:id="@+id/declarationLayout" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_marginBottom="10dp" > 

     <TextView 
      android:id="@+id/widgetLabel" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="10dp" 
      android:text="@string/declarationCompletion" 
      android:textColor="@android:color/black" 
      android:textSize="@dimen/normaltextsize" /> 

     <Button 
      android:id="@+id/doneButton" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/widgetLabel" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="15dp" 
      android:background="#436EEE" 
      android:gravity="left" 
      android:paddingBottom="10dp" 
      android:paddingLeft="5dp" 
      android:paddingTop="10dp" 
      android:text="@string/doneWithFollowup" 
      android:textColor="@android:color/white" 
      android:textSize="@dimen/normaltextsize" /> 
    </RelativeLayout> 

    <ListView 
     android:id="@+id/listViewFollowup" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@id/declarationLayout" 
     android:layout_below="@id/listViewHeaderText" 
     android:background="@android:color/transparent" 
     android:cacheColorHint="@null" 
     android:choiceMode="singleChoice" /> 

</RelativeLayout> 

任何提示?

enter image description here

+0

显示您的布局文件。 –

+0

您是否使用scrollView作为此列表视图的父布局?因为使用ScrollView和列表在一起,导致这样的问题... – Shrikant

+0

不,我不是。 – Sana

回答

1

我所知道的唯一的解决办法是创建与宽度1DP和高度的按钮,因为你需要和位置这一项下的单子填写休息。

我提前为这个相当“肮脏”的建议提供了appologize - 但是当我一直遇到这种问题时,尝试了bottom_margins,填充,固定尺寸的背景,..我还没有找到任何一种“干净”解。

期待您对此主题有更好的工作建议:-)

相关问题