Я пытаюсь повторить компоновку Apple своих значков приложений.У меня проблемы с использованием <merge>
и <include>
, так как при запуске приложения оно не отображается.
Вот часть слияния:
<Button android:id="@+id/deleteContact"
android:text="X"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView android:id="@+id/personName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="bottom|right"
android:layout_gravity="bottom|right"
android:textSize="20sp"
android:text="asdfasdf"/>
<ImageView android:id="@+id/personImage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/icon"/>
</merge>
Включение здесь:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<include layout="@layout/icon"/>
</LinearLayout>
Я помещаю их в сетку:
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contactsGrid"
android:layout_width="fill_parent"
android:layout_weight="1"
android:layout_height="fill_parent"
android:numColumns="3"
android:horizontalSpacing="3dip"
android:verticalSpacing="3dip" />
Нам удалось объединить изображениеи текст до сих пор с использованием относительных слоев, однако, когда мы добавляем кнопку удаления, сам значок больше не может быть нажат.