2015-07-20 65 views
0

我的佈局元素有問題。他們正在手機中顯示,但在Genymotion或Android模擬器中均未顯示。Android底部元素沒有顯示

兩個按鈕不顯示在底部。

這是我的代碼。

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="vitrine.ndex.com.vitrine.fragments.FavouriteFragment"> 

<!-- TODO: Update blank fragment layout --> 

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


    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/linearLayout2" 
     android:layout_alignParentBottom="true"> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:text="New Button" 
      android:id="@+id/cartButton" 
      android:layout_weight="1" /> 

     <Button 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:text="New Button" 
      android:id="@+id/historyButton" 
      android:layout_weight="1" /> 
    </LinearLayout> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/linearLayout3"> 

     <include 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      layout="@layout/header_panel_layout" /> 
    </LinearLayout> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/linearLayout3" 
     android:layout_above="@+id/linearLayout2"> 

     <ListView 
      android:layout_width="wrap_content" 
      android:layout_height="0dp" 
      android:id="@+id/favouriteShopListView" 
      android:layout_weight="1" /> 
    </LinearLayout> 

</RelativeLayout> 

回答

0

您需要夫婦在佈局的變化。

  1. 整個包住RelativeLayoutScrollView
  2. 取出ListViewRelativeLayout,並把它放在一個佈局是外ScrollView
+0

把佈局'ListView'內'ScrollView'是不是好的做法。 – poss

+0

請問,請解釋一下,我應該改變哪些佈局元素? – zxc123qwe098qqq

+1

@poss:啊!我只是錯過了一個ListView。是的。我更新了我的答案。謝謝 –