2014-09-13 45 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 。

如果你想在列表視圖頂部的形象,做類似下面的內容:

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

如果你想在列表視圖之前的圖像,做類似下面的東西:

<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> 
相關問題