2014-01-27 2 views
0

У меня есть ListView, и я хотел бы иметь следующую структуру:Android: выравнивать пункты в Listview

link to example image

У меня есть несколько проблем: текст не совпадает с изображением, правое изображение исчезает в некоторых предметах, 2 строки не показывают ... Мне нужна помощь, пожалуйста. Это мой код:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_alignParentTop="true" 
android:background="@drawable/listview_naranja" 
android:orientation="horizontal" 
android:padding="5dip" > 

<LinearLayout 
    android:id="@+id/thumbnail" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentTop="true" 
    android:layout_marginRight="5dip" 
    android:padding="3dip" 
    android:paddingTop="5dip" > 

    <ImageView 
     android:id="@+id/imagenListview" 
     android:layout_width="100dip" 
     android:layout_height="100dip" /> 
</LinearLayout> 

<TextView 
    android:id="@+id/textoListviewNombre" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignTop="@+id/thumbnail" 
    android:layout_toRightOf="@+id/thumbnail" /> 

<TextView 
    android:id="@+id/textoListviewTipo" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/textoListviewNombre" 
    android:layout_marginTop="1dip" 
    android:layout_toRightOf="@+id/thumbnail" /> 

<ImageView 
    android:id="@+id/imagenVisto" 
    android:layout_width="40dp" 
    android:layout_height="40dp" 
    android:layout_gravity="center_vertical" 
    android:paddingLeft="3dp" 
    android:paddingRight="3dp" /> 

<ImageView 
    android:id="@+id/imagenVisto" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_centerVertical="true" /> 

</RelativeLayout> 

благодаря

EDIT:

Новый код размещен. Мой textoListviewNombre не AlignTop с моей миниатюрой и на моей пиктограмме появляется мой imagenVisto

+0

Это будет осуществляться путем создания пользовательского ListView –

+0

да, я хочу пользовательский ListView – user3231711

ответ

0

enter image description here

Макета

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:src="@drawable/ic_play_live" /> 


    <ImageView 
     android:id="@+id/imageView2" 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentTop="true" 
     android:src="@drawable/ic_play_live" /> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_alignBottom="@+id/imageView1" 
     android:layout_toRightOf="@+id/imageView1" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Large Text" 
      android:textAppearance="?android:attr/textAppearanceLarge" /> 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="TextView" /> 

    </LinearLayout> 

</RelativeLayout> 
Смежные вопросы