Я сейчас работаю над своим первым приложением для Android. В представлении списка мне нужно иметь следующую организацию в каждой строке:
- Слева: одна главная иконка, которая занимает всю высоту строки
- В середине: 2 текста, один под другим
- Справа: 2 иконки, одна под другой
Я получаю файл row.xml, как этот, но это не работает, как я ожидаю.
Знаете ли вы, если что-то очевидное отсутствует в этом файле?
Большое спасибо,
Люк
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="@+id/icon"
android:layout_width="48px"
android:layout_height="48px"
android:layout_marginRight="0dip"
android:src="@drawable/icon" />
<LinearLayout
android:orientation="vertical"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="wrap_content">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="16dp"
android:textStyle="bold"
android:text="TITLE"
android:paddingLeft="5dp"
/>
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="14dp"
android:text="DESCRIPTION"
android:paddingLeft="5dp"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="right">
<ImageButton
android:id="@+id/button_modify"
android:layout_width="16px"
android:layout_height="16px"
android:src="@drawable/deleteicon"
/>
<ImageButton
android:id="@+id/button_delete"
android:layout_width="16px"
android:layout_height="16px"
android:src="@drawable/modifyicon"
/>
</LinearLayout>