2014-09-13 5 views
0

je suis nouveau dans android. voici ma liste vue Code articles:comment utiliser l'image entre les éléments de la vue liste?

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" > 
<TableRow> 
    <ImageView 
     android:id="@+id/img" 
     android:layout_width="50dp" 
     android:layout_height="50dp"/> 
    <TextView 
     android:id="@+id/txt" 
     android:layout_width="wrap_content" 
     android:layout_height="50dp" /> 
</TableRow> 
</TableLayout> 

je veux ajouter une image simple sur le dessus de mon point de vue de la liste s'il vous plaît me aider

Répondre

0

Aligner le ImageView vers le haut ou Mettre un ImageView avant d'appeler le ListView .

Si vous voulez que l'image en haut de la listview, faire quelque chose de semblable à ce qui suit:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" > 
<TableRow> 

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
     <ImageView 
      android:id="@+id/img" 
      android:layout_width="50dp" 
      android:layout_height="50dp"/> 
    </RelativeLayout> 

    <ImageView 
     android:id="@+id/img" 
     android:layout_width="50dp" 
     android:layout_height="50dp"/> 
    <TextView 
     android:id="@+id/txt" 
     android:layout_width="wrap_content" 
     android:layout_height="50dp" /> 
</TableRow> 
</TableLayout> 

Si vous voulez une image avant la listview, faire quelque chose de semblable à ce qui suit:

<ImageView 
     android:id="@+id/img" 
     android:layout_width="50dp" 
     android:layout_height="50dp"/> 

<ListView 
      android:id="@+id/listview_row" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
    </ListView> 
Questions connexes