У меня есть 9-patch drawable (date_time). И я хочу разместить этот ресурс по сравнению с содержимым Relative Layout, поэтому все дочерние представления должны быть нарисованы поверх этого изображения. Вот XML Layout:RelativeLayout background drawable overlap content
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="23dp"
android:layout_below="@id/tv_map_address"
android:layout_marginTop="11dp"
android:layout_marginBottom="12dp"
android:background="@drawable/date_time">
<ImageView
android:id="@+id/iv_map_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_centerVertical="true"
android:src="@drawable/ic_map_distance"/>
<TextView
android:id="@+id/tv_map_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/iv_map_distance"
android:layout_centerVertical="true"
android:textColor="@color/white"
android:textSize="11sp"
android:text="2,7 км"
fontPath="fonts/Roboto-Medium.ttf"/>
<ImageView
android:id="@+id/iv_map_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/tv_map_distance"
android:layout_centerVertical="true"
android:src="@drawable/ic_map_path"/>
<TextView
android:id="@+id/tv_map_path"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/iv_map_path"
android:layout_centerVertical="true"
android:textColor="@color/white"
android:textSize="11sp"
android:text="3,2 км"
fontPath="fonts/Roboto-Medium.ttf"/>
</RelativeLayout>
Но почему-то этот фон накладывается все содержание ребенка. Здесь показано, что происходит.
Но если я заменить
android:background="@drawable/date_time"
в
android:background="#0000FF"
Все хорошо, и выход в следующем:
Можете ли вы объяснить мне, что я делаю неправильно?
Обновление: Вот мой 9-патч.
Опубликуйте свои 9-патч, доступные индикаторы контента, вероятно, неверные. –
@blipinsk Я добавил drawable. Также я могу загрузить его на какой-то образ, если вам это нужно для тестов. – Anatol