2016-03-11 1 views
0

J'ai un textview qui n'apparaît pas sur l'émulateur/périphérique réel. Voici le code xml de CardView, que j'utilise pour ajouter des vues de cartes à une vue recycleur.TextView disparaît

(Celui qui ne semble pas le dernier sur le texte XML, "há 10 minutos")

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/card_view" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:foreground="?attr/selectableItemBackground" 
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> 

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

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

     </LinearLayout> 
     <TextView 
      android:id="@+id/card_title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Sabia que:" 
      android:layout_marginLeft="@dimen/md_keylines" 
      android:layout_marginTop="@dimen/md_keylines" 
      android:layout_marginRight="@dimen/md_keylines" 
      android:ellipsize="end" 
      android:textColor="@color/dark_grey" 
      android:textSize="@dimen/article_titles"/> 

     <TextView 
      android:id="@+id/card_text" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/card_title" 
      android:text="asdjksah asdhsa oidhs diosah saidh asoidhsd saoidsahd iaosd hsaid hasoih " 
      android:layout_marginLeft="@dimen/md_keylines" 
      android:layout_marginTop="@dimen/md_keylines" 
      android:layout_marginBottom="@dimen/md_keylines" 
      android:layout_marginRight="@dimen/md_keylines" 
      android:ellipsize="end" 
      android:textColor="@color/dark_grey" 
      android:textSize="@dimen/article_subheading" /> 

     <!--Isto é dentro da Text view acima --> 

     <Button 
      android:id="@+id/action_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="@dimen/md_keylines" 
      android:layout_marginBottom="@dimen/md_keylines" 
      android:layout_below="@+id/card_text" 
      style="?android:attr/borderlessButtonStyle" 
      android:textColor="?attr/colorAccent" 
      android:text="Saber mais" /> 

     <ImageButton 
      android:id="@+id/share_button" 
      android:layout_width="@dimen/cards_button_width" 
      android:layout_height="@dimen/cards_button_height" 
      android:layout_marginRight="@dimen/md_keylines" 
      android:src="@drawable/ic_share_black_24dp" 
      android:layout_below="@+id/card_text" 
      android:layout_alignParentRight="true" 
      style="?android:attr/borderlessButtonStyle" 
      android:layout_marginBottom="@dimen/md_keylines" 
      android:tint="@color/button_grey" /> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:text="há 10 minutos" 
      android:id="@+id/textView2" 
      /> 

    </RelativeLayout> 
</android.support.v7.widget.CardView> 

Le studio android:

enter image description here

sur émulateur (le même problème que le périphérique réel

enter image description here

Le texte est différent car j'utilise un XMLParser pour les phrases.

+0

Vous voulez dire le texte: 'há 10 minutos' ?? –

+0

Oui, c'est pourquoi j'ai écrit le dernier dans le texte xml, et pourquoi j'ai mis le texte xml en premier. Mais je vais éditer! –

+0

commentaire 'android: textAppearance ="? Android: attr/textAppearanceSmall "' –

Répondre

0

Vous utilisez relativelayout qui laisse son contenu se chevaucher. Vous devez spécifier android: layout_below dans votre dernier TextView pour spécifier la position comme les précédentes.