В основном у меня есть ImageView в одном из линейных макетов, когда весы установлены на каждом из моих макетов, которые изменяются, то же самое происходит с ImageView в макете. Проблема - только высота, которая фактически меняет ширину, остается неизменной.layout_weight изменяет размеры изображения
Почему это проблема? У меня есть customView, и мне нужно поместить его на чашку, чтобы он требовал x, y пучков чашки и размера (ширины и высоты). Теперь я получаю разную ширину с разными размерами экрана.
Код Компоновка:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="3"
android:orientation="horizontal" >
<RelativeLayout
android:id="@+id/rlmainContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/ivCup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cup1_r" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
</LinearLayout>
</LinearLayout>
решение Archie.bpgc (установка layout_height = "0dp") не помогает. Установка несколько изображений, и все они с непропорциональной шириной:
<?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="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal" >
<ImageView
android:id="@+id/ivCup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cup1_r" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/ivCup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cup1_r" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/ivCup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cup1_r" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<ImageView
android:id="@+id/ivCup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cup1_r" />
</LinearLayout>
</LinearLayout>
Не помогает, спасибо за быстрый ответ. – user2060190
@ user2060190 выглядит как я неправильно понял вопрос. Вы хотите, чтобы ваши «ImageViews» были равны по высоте ** (что я мог сделать из вашего кода). Если вы хотите, чтобы ширина была одинаковой для всех изображений, удалите 'wrap_content' и установите некоторое значение или' fill_parent'. –