tags:

views:

48

answers:

2

I have this layout.

<ImageView
  android:id="@+id/icon"
  android:layout_gravity="left"
  android:layout_marginLeft="5px"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:src="@drawable/icon"/>

  <ImageView
  android:id="@+id/header_avatar"
  android:layout_gravity="left"
  android:layout_marginLeft="5px"
  android:layout_width="?????"
  android:layout_height="?????"/>

I want the second ImageView to have the very same size of the first ImageView so that it resizes the pictures I set in the second view (header_avatar) to the same of the first view (@drawable/icon). Is this posible or do I have to do it programmatically? Cannot I reference the first view's width and length on the second view?

Thanks in advance.

A: 

Using relative layouts could do the trick. If not, do it programatically in the onCreate method of your activity.

Moss
A: 

Use Styles. Define a style which fits both image views and assign it to both like in the example.

Octavian Damiean