2017-10-17 11 views
-1

Bonjour, je commence par développer Android. Je suis en train de modifier avec Android Studio un exemple open source.Pas un frère ou une soeur dans le même RelativeLayout?

J'ai seulement modifié le fichier string.xml et certains fichiers .png. Dans le simulateur Android, cela fonctionne parfaitement mais quand j'essaie de générer le fichier Apk signé, je reçois deux erreurs avec une description similaire.

C'est l'un d'entre eux (la ligne est avec marquage *):

Error:(33) Error: @id/linear_adview is not a sibling in the same RelativeLayout [Not Sibling]

+0

S'il vous plaît partager fichier .xml –

+0

S'il vous plaît fournir votre mise en page xml – nhoxbypass

+0

Tout d'abord vous devez supprimer « + "de Ce android: layout_above =" @ + id/linear_adview " À android: layout_above = "@ id/linear_adview" –

Répondre

0
<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:ads="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/rl_content_root" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/background"> 
<LinearLayout`enter code here` 
     android:id="@+id/linear_adview" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 
     <com.google.android.gms.ads.AdView 
      android:id="@+id/ad_view_editimg" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      ads:adSize="BANNER" 

<RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_above="@+id/sticker_recycler_view" 
      android:layout_below="@id/linear_adview"> 

      <FrameLayout 
       android:id="@+id/sticker_framelayout" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_below="@id/linear_adview"> 


       <ImageView 
        android:id="@+id/pic_edit_imageview" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:padding="5dp" 
        android:scaleType="centerCrop" 
        android:src="@drawable/background" 

        /> 

       <include 
        layout="@layout/text_layout" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" /> 

      </FrameLayout> 


     </RelativeLayout> 
    </LinearLayout> 
    <android.support.v7.widget.RecyclerView 
      android:id="@+id/sticker_recycler_view" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="5dp" 
      android:visibility="visible" 
      android:layout_above="@+id/linearLayout" /> 

    <LinearLayout 
     android:id="@+id/linearLayout" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     android:layout_alignParentBottom="true" 
     android:background="@color/colorPrimary" 
     android:orientation="horizontal"> 

     <TextView 
      android:id="@+id/smoke_tv" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_gravity="center_vertical" 
      android:layout_weight="1" 
      android:clickable="true" 
      android:background="@color/black" 
      android:gravity="center" 
      android:text="@string/smoke" 
      android:textColor="@color/white" 
      android:textSize="18sp" /> 

     <TextView 
      android:id="@+id/text_tv" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_gravity="center_vertical" 
      android:layout_weight="1" 
      android:clickable="true" 
      android:gravity="center" 
      android:text="@string/text" 
      android:textColor="@color/white" 
      android:textSize="18sp" /> 

     <TextView 
      android:id="@+id/share_tv" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_gravity="center_vertical" 
      android:layout_weight="1" 
      android:gravity="center" 
      android:clickable="true" 
      android:text="@string/share" 
      android:textColor="@color/white" 
      android:textSize="18sp" /> 
    </LinearLayout> 
</RelativeLayout>` 
` 
0

FrameLayout avec android:id="@+id/sticker_framelayout" n'est pas un frère direct de LinearLayout avec android:id="@+id/linear_adview" et c'est la raison pour laquelle vous ne pouvez pas utiliser android:layout_below="@id/linear_adview" dedans. En fait, vous pouvez fusionner RelativeLayout et FrameLayout en une seule vue:

<RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/sticker_recycler_view" 
     android:layout_below="@id/linear_adview"> 

     <FrameLayout 
      android:id="@+id/sticker_framelayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@id/linear_adview"> 

(...) 

     </FrameLayout> 

à

<FrameLayout 
      android:id="@+id/sticker_framelayout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_above="@+id/sticker_recycler_view" 
      android:layout_below="@id/linear_adview"> 

(...) 

</FrameLayout>