2014-10-17 32 views
0

我設計了佈局,其中我有listview,它將顯示200多個名單的名單,在底部我有四個按鈕。列表視圖的最後兩個元素隱藏

問題是列表視圖的最後兩個元素隱藏在該頁腳後面。我無法弄清楚。 任何幫助表示讚賞

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#ffffff" 
    android:orientation="vertical" 
    android:keepScreenOn="true" 
    > 

    <include 
     android:id="@+id/store_screen_action_bar" 
     layout="@layout/action_bar" /> 
    <ListView 
     android:id="@+id/store_screen_lists" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_below="@id/store_screen_action_bar" 
     android:layout_marginLeft="20dip" 
     android:layout_marginRight="20dip" 
     android:layout_marginTop="20dip" 
     android:cacheColorHint="#00000000" 
     android:divider="@drawable/divider_line" 
     android:fastScrollEnabled="false" 
     android:headerDividersEnabled="false" 
     android:smoothScrollbar="true" 
     android:listSelector="@android:color/transparent" 
     /> 
    <TextView 
     android:id="@android:id/empty" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:textSize="15sp" 
     android:gravity="center_horizontal|center_vertical" 
     /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="#c8d5e1" 
     android:gravity="center_horizontal|bottom" 
     android:orientation="horizontal" 
     android:layout_alignParentBottom="true" 
     > 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="15dip" 
      android:orientation="vertical" > 

      <ImageButton 
       android:id="@+id/store_screen_anouncement" 
       android:layout_width="60dip" 
       android:layout_height="60dip" 
       android:layout_marginLeft="10dip" 
       android:layout_marginTop="5dip" 
       android:background="@drawable/round_corner" 
       android:paddingBottom="40dip" 
       android:paddingLeft="30dip" 
       android:paddingRight="20dip" 
       android:paddingTop="40dip" 
       android:src="@drawable/announcement" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="2dip" 
       android:gravity="center_horizontal" 
       android:text="@string/annoucement_text" 
       android:textColor="#306190" 
       android:textSize="12sp" /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="15dip" 
      android:orientation="vertical" > 

      <ImageButton 
       android:id="@+id/store_screen_group" 
       android:layout_width="60dip" 
       android:layout_height="60dip" 
       android:layout_marginLeft="3dip" 
       android:layout_marginRight="10dip" 
       android:layout_marginTop="5dip" 
       android:background="@drawable/round_corner" 
       android:padding="20dip" 
       android:src="@drawable/groups" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="2dip" 
       android:layout_marginLeft="10dip" 
       android:gravity="center_horizontal" 
       android:paddingLeft="5dip" 
       android:text="@string/groups_text" 
       android:textColor="#306190" 
       android:textSize="12sp" /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="5dip" 
      android:layout_marginTop="15dip" 
      android:orientation="vertical" > 

      <ImageButton 
       android:id="@+id/store_screen_interupt_all" 
       android:layout_width="60dip" 
       android:layout_height="60dip" 
       android:layout_marginLeft="10dip" 
       android:layout_marginRight="10dip" 
       android:layout_marginTop="5dip" 
       android:background="@drawable/round_corner" 
       android:padding="10dip" 
       android:src="@drawable/interrupt" /> 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="2dip" 
       android:layout_marginLeft="10dip" 
       android:gravity="center_horizontal" 
       android:text="@string/interrupt_text" 
       android:textColor="#306190" 
       android:textSize="12sp" /> 
     </LinearLayout> 

     <FrameLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dip" > 

      <LinearLayout 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="5dip" 
       android:layout_marginTop="5dip" 
       android:orientation="vertical" > 

       <ImageButton 
        android:id="@+id/store_screen_ear_box" 
        android:layout_width="60dip" 
        android:layout_height="60dip" 
        android:layout_marginLeft="10dip" 
        android:layout_marginRight="10dip" 
        android:layout_marginTop="5dip" 
        android:background="@drawable/round_corner" 
        android:padding="60dip" 
        android:src="@drawable/earbox" /> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginBottom="2dip" 
        android:layout_marginLeft="10dip" 
        android:gravity="center_horizontal" 
        android:paddingLeft="10dip" 
        android:text="@string/earbox_text" 
        android:textColor="#306190" 
        android:textSize="12sp" /> 
      </LinearLayout> 

      <TextView 
       android:id="@+id/play_announcement_no_text" 
       android:layout_width="25dip" 
       android:layout_height="25dip" 
       android:layout_gravity="left" 
       android:layout_marginRight="5dip" 
       android:background="@drawable/green_circle" 
       android:gravity="center" 
       android:visibility="gone" 
       android:textColor="@android:color/white" /> 

      <TextView 
       android:id="@+id/play_message_no_text" 
       android:layout_width="25dip" 
       android:layout_height="25dip" 
       android:layout_gravity="right" 
       android:layout_marginBottom="20dip" 
       android:background="@drawable/red_circle" 
       android:gravity="center" 
       android:visibility="gone" 
       android:textColor="@android:color/white" /> 
     </FrameLayout> 
    </LinearLayout> 

</RelativeLayout> 
+0

和什麼是根la你呢? – Selvin 2014-10-17 14:35:47

+0

根佈局是RelativeLayout,我已經發布了整個代碼 – Naga 2014-10-17 14:36:32

+1

添加id到頁腳並將它移動到xml(右後包括)之後的listview中...然後在listview中添加android:above = footer_id – Selvin 2014-10-17 14:39:25

回答

1

這些屬性添加到ListView

android:layout_below="@+id/store_screen_action_bar" 
android:layout_above="@+id/footer" 

,並設置idLinearLayout頁腳:

<LinearLayout 
    android:id="@+id/footer" 
0

使用android:layout_below="@id/list爲您的頁腳

+0

那麼footer會隱形嗎? – Selvin 2014-10-17 14:38:28

+0

我想你的列表和頁腳是重疊的,所以你最後的列表項在你的頁腳後面。有了這段代碼,你可以將腳註放在你的列表中。是的,您的頁腳將可見 – bbvanee 2014-10-17 14:40:35