У меня проблема с дизайном макета приложения. Это то, что я пытаюсь получить:Android: сделать ImageView соответствовать высоте другого вида
=========================================================
| ============= ================ ================ |
| | | | LinearLayout | | LinearLayout | |
| | | | ============ | | ============ | |
| | | | | TextView | | | | TextView | | |
| | ImageView | | ============ | | ============ | |
| | | | ============ | | ============ | |
| | | | | TextView | | | | TextView | | |
| | | | ============ | | ============ | |
| | | | ============ | | ============ | |
| | | | | TextView | | | | TextView | | |
| | | | ============ | | ============ | |
| ============= ================ ================ |
=========================================================
Это whay я сделал до сих пор (я удалил Идентификаторы чужую материал для ясности):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical" >
<ImageView
android:contentDescription="@string/logo"
android:layout_width="wrap_content"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="left|center_vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center_vertical"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true" />
</LinearLayout>
</LinearLayout>
Мои проблема в том, что я хочу использовать изображения с высоким разрешением и масштабировать их, чтобы соответствовать самому высокому линейному расслоению рядом с ним. Моя идея состоит в том, чтобы андроид уменьшал изображение на устройствах с низким разрешением dpi, поэтому использовал те же изображения и макет для всех платформ.
Как и сейчас, высота основного контейнера достигает высоты изображения. Я хочу, чтобы основная высота контейнера была такой же, как и «самый высокий» linearlayout, и заставляла изображение снижаться, чтобы соответствовать основному контейнеру.
Любые идеи?
Спасибо!
PD: Извините мой английский! : $
Возможный дубликат [MATCH \ _PARENT, если вид на сестры больше, WRAP \ _CONTENT, если вид на сестре меньше] (http://stackoverflow.com/questions/17119173/match-parent-if-sibling-view-is- more-wrap-content-if-sibling-view-is-less) – Cris