Ich versuche Knöpfe unter einen RecyclerView
zu setzen, so dass, wenn Sie den ganzen Weg nach unten scrollen in der RecyclerView
, sollte die Taste sein (Zurück/Weiter)Buttons unten RecyclerView
Die XML Ich bin Versuchen ist unten angegeben. Aber die RecyclerView
braucht den ganzen Platz.
Bitte beachten Sie, ich habe versucht layout_height=0
und layout_weight=1
setzen, aber es funktioniert immer noch nicht.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="0dp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="0dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.app.home"
tools:showIn="@layout/app_bar_home">
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_homepost"
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:layout_height="0dp"
android:layout_weight="1">
</android.support.v7.widget.RecyclerView>
<LinearLayout
android:id="@+id/next_prev_button"
android:layout_below="@+id/rv_homepost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp"
android:gravity="center_vertical">
<Button
android:id="@+id/prev_button"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-4dp"
android:enabled="true"
android:text="Previous" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="@+id/next_button"
style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="-4dp"
android:enabled="true"
android:text="Next" />
</LinearLayout>
</LinearLayout>
Sie fehlen nur 'android: orientation = "vertical"' in der Wurzel 'LinearLayout' Sonst sieht es gut aus – Sharj