You can't do that in that way, but you have 2 options here:
Option 1: declare the value as a dimension and the use it:
Declare two values for height and width in dimens.xml that can be found at res/values.
<dimen name="image_width">100dp</dimen> <dimen name="image_height">100dp</dimen>
Then use them in your xml like this:
<ImageView android:id="@+id/myimage2" android:layout_height="@dimen/image_height" android:layout_width="@dimen/image_width"/>
Option 2: Create a style associated with your ImageView:
First thing to do is to create the style for your views and place it in styles.xml that can be found at res/values.
<style name="my_image_view_style"> <item name="android:layout_height">100dp</item> <item name="android:layout_width">100dp</item> </style>
Add your created style to your ImageView:
<ImageView android:id="@+id/myimage2" style="@style/my_image_view_style"/>
dimens.xmlwhich will come underres>valuesand use that for whichever xml element you want<dimen name="myimageheight">100dp</dimen>along withandroid:layout_height="@dimens/myimageheight"(repeat this where needed).