2017-10-15 2 views
-1

Salut, je suis en train d'ajouter Button ci-dessus Recyclerview mais ne fonctionne pas:comment ajouter le bouton ci-dessus recyclerview

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:ads="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="#008080" 
tools:context=".fragmentUsers"> 
<!-- TODO: Update blank fragment layout --> 
<Button 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="Send us" 
    android:layout_above="@+id/rc"/> 
<android.support.v7.widget.RecyclerView 
    android:id="@+id/rc" 
    android:numColumns="2" 
    android:scrollbars="vertical" 
    android:layout_marginTop="2dp" 
    android:layout_above="@+id/adView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 
<TextView 
    android:id="@+id/loadingtext" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textSize="14sp" 
    android:gravity="center" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:text="txt"/> 
</RelativeLayout> 

Répondre

1

Remplacez votre code ci-dessous avec le code, qui vous aidera à ce que vous voulez

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:ads="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" 
android:background="#008080" 
> 
<!-- TODO: Update blank fragment layout --> 
<Button 
    android:id="@+id/your_id" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="Send us" 
    /> 
<android.support.v7.widget.RecyclerView 
    android:layout_below="@+id/your_id" 
    android:id="@+id/rc" 
    android:numColumns="2" 
    android:scrollbars="vertical" 
    android:layout_marginTop="2dp" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" /> 
<TextView 
    android:id="@+id/loadingtext" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textSize="14sp" 
    android:gravity="center" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:text="txt"/>