2017-04-23 1 views
1

okay, schön und einfach:Disapearing Bilder

Im soll das bekommen: enter image description here

aber aus irgendeinem magischen Grund im immer diese: enter image description here

Testcode:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" android:layout_width="match_parent" 
    android:layout_height="match_parent" android:paddingTop="100dp"> 

    <ImageView 
     android:id="@+id/imageView" 
     android:layout_width="match_parent" 
     android:layout_height="100dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentTop="true" 
     app:srcCompat="@drawable/ic_dislike" /> 

    <ImageButton 
     android:id="@+id/imageButton" 
     android:layout_width="match_parent" 
     android:layout_height="100dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:layout_below="@+id/imageView" 
     android:layout_marginTop="20dp" 
     app:srcCompat="@mipmap/ic_launcher" /> 
</RelativeLayout> 

gleicher happends mit "echtem Code":

<RelativeLayout 
      android:id="@+id/counters" 
      android:layout_width="match_parent" 
      android:layout_height="48dp" 
      android:background="#FF0000" 
      android:gravity="center_vertical"> 


      <RelativeLayout 
       android:id="@+id/views_layout" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"> 

       <ImageButton 
        android:id="@+id/views_img" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_alignParentLeft="true" 
        android:layout_margin="4dp" 
        android:background="#FFFF" 
        app:srcCompat="@drawable/ic_views" /> 

       <TextView 
        android:id="@+id/views_count" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_toRightOf="@id/views_img" 
        android:background="@color/colorAccent" 
        android:text="27,547" 
        android:textColor="#000" /> 

      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/likes_layout" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@id/views_layout"> 

       <ImageButton 
        android:id="@+id/likes_img" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_margin="4dp" 
        android:background="#FFFF" 
        app:srcCompat="@drawable/ic_like" /> 

       <TextView 
        android:id="@+id/likes_count" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_toRightOf="@id/likes_img" 
        android:text="1,232" 
        android:textColor="#000" /> 
      </RelativeLayout> 

      <RelativeLayout 
       android:id="@+id/dislikes_layout" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@id/likes_layout"> 

       <ImageButton 
        android:id="@+id/dislikes_img" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_margin="4dp" 
        android:background="#FFFF" 
        app:srcCompat="@drawable/ic_dislike" /> 

       <TextView 
        android:id="@+id/dislikes_count" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerVertical="true" 
        android:layout_toRightOf="@id/dislikes_img" 
        android:text="112" 
        android:textColor="#000" /> 
      </RelativeLayout> 
     </RelativeLayout> 

     <!--title and desc--> 
     <RelativeLayout 
      android:id="@+id/title_and_desc" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 


      <TextView 
       android:id="@+id/title_txt" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Fucking amazing video!!!!" 
       android:textColor="#000" 
       android:textSize="18sp" /> 

      <TextView 
       android:id="@+id/desc_txt" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/title_txt" 
       android:layout_marginTop="8dp" 
       android:maxLines="4" 
       android:text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat." /> 

     </RelativeLayout> 

Aktivität an diesem Punkt an ist fast alles auf Kommentar, da ich dieses Ding Figur kippe, so bezweifle ich, dass es etwas damit

möglicherweise Konflikte zu tun hat?

Abhängigkeiten
{ 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
// androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
//  exclude group: 'com.android.support', module: 'support-annotations' 
// }) 
    compile files('libs/YouTubeAndroidPlayerApi.jar') 
    compile 'com.android.support:appcompat-v7:25.3.1' 
    compile 'com.android.support:design:25.3.1' 

    compile 'com.google.apis:google-api-services-youtube:v3-rev182-1.22.0' 
    compile 'com.google.http-client:google-http-client-android:1.20.0' 
    compile 'com.google.api-client:google-api-client-android:1.20.0' 
    compile 'com.google.api-client:google-api-client-gson:1.20.0' 
} 

Antwort

1

Versuchen entfernen "+" in dieser Zeile Ihres Image in Ihrem Layout:

android:layout_below="@+id/imageView" 

Weil "+" verwenden sollte nur auf "Android: id" Parameter eine ID zuweisen eine Ansicht

Mit dieser zusätzlichen „+“ layout_below sollte die Positionierung der Knopf unterhalb des Bildes zu korrigieren, werden scheitern.

Eine andere Möglichkeit ist versuchen, alle zu ersetzen "App: srcCompat" von „android: src“. Da Sie keine Vektor Drawables mit

+0

Daumen hoch für das zu bemerken !!! (i o Idee, warum es es so automatisch vervollständigt), aber auch immer, es hat das Problem nicht lösen; (..... (getestet habe ich es mit „Testcode“ haben, nur echte) –

+0

Also, versuchen, alle zu ersetzen „app: srcCompat“ von „android: src“. da Sie keine Vektor Drawables mit –

+0

YAY, war, dass die issue e !! THX für Ihre Hilfe. –

1

Stellen Sie sicher, dass Sie vectorDrawables.useSupportLibrary = true in Ihrer build.gradle Datei

android { 
    defaultConfig { 
    vectorDrawables.useSupportLibrary = true 
    } 
} 
+0

nein, Dosent scheint zu arbeiten. Ich vergaß zu erwähnen, dass es nur in dieser einen Aktivität passierte –

Verwandte Themen