2016-09-21 3 views
1

Hier ist mein Layout für feste Fußzeile. Eine , die RecyclerView enthält, ist an FrameLayout angefügt. Der Inhalt von RecyclerView wird jedoch vom Footer-Layout überlagert.Feste Fußzeile in Android-Layout

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

<FrameLayout 
    android:id="@+id/home_parent_framelayout" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

<LinearLayout 
    android:id="@+id/footer_linearlayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:background="#f1c21e" 
    android:layout_alignParentBottom="true"> 

    <footer layout> 

    </LinearLayout> 

</RelativeLayout> 

Antwort

1

In Ihrem FrameLayout geben Eigenschaft

android:layout_above="@+id/footer_linearlayout" 

es sowohl FrameLayout und Footer angezeigt.

Fügen Sie diese Art und Weise:

<FrameLayout 
    android:id="@+id/home_parent_framelayout" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:layout_above="@+id/footer_linearlayout" /> 

Erläuterung:

Ihre LinearLayout nicht Bottom nicht angezeigt werden, wenn Sie fix Footer erstellen Ihre Eltern-Kind-Layout Sie layout_above Eigenschaft auf der Höhe zu geben haben, Der Fix Footer bedeutet in Ihrem Fall LinearLayout. Höhe so LinearLayout auf dem Bildschirm angezeigt werden die Eltern-Kind-FrameLayout Sie android:layout_above="@+id/linearLayout geben ..

+0

framelayout hat die Höhe als Wrap Inhalte so, wenn ich android hinzufügen: layout_above = „@ + id/footer_linearlayout“ die framelayout Layout oben Fußzeile angezeigt wird hinterlässt jedoch viel freien Raum (framelayout), da es einen hohen Wrap-Inhalt hat. –

+0

Dann geben Sie 'FrameLayout' height an' match_parent' an, es nimmt die volle Höhe von 'FrameLayout' an. es wird dein Problem lösen .. – Ironman

+0

@Androidjack hast du es gelöst oder nicht ?? – Ironman

1

Versuchen Sie folgendes:

<?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"> 

    <FrameLayout 
     android:id="@+id/home_parent_framelayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_above="@+id/footer_linearlayout" /> 

    <LinearLayout 
     android:id="@+id/footer_linearlayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:background="#f1c21e" 
     android:orientation="horizontal"> 

//Your footer layout 
    </LinearLayout> 

</RelativeLayout> 
Verwandte Themen