2014-09-13 2 views
0

Я новичок в android. это мой список просмотреть детали код:Как использовать изображение между элементами списка?

<?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> 

я хочу, чтобы добавить простое изображение на верхней части моего списка зрения , пожалуйста, помогите мне

ответ

0

Совместите ImageView к верхней или положить ImageView перед вызовом ListView ,

Если вы хотите, чтобы изображение в верхней части ListView, сделать что-то похожее на следующее:

<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> 

Если вы хотите изображение перед ListView, сделать что-то похожее на следующее:

<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> 
Смежные вопросы