Can I do calculation inside dimens.xml?

android

Solution

No. The resources are resolved as the per the device and its orientation. Hence you cannot use references to other resources and have calculations on them in `dimens.xml`.

Problem

I just wondering can I do some calculations inside dimens.xml? I have tried it but doesn't work: dimens.xml ``` <dimen name="wrap_content">-2dp</dimen> <dimen name="width">@dimen/wrap_content * 0.5</dimen> <dimen name="height">@dimen/wrap_content * 0.5</dimen> ``` my_layout.xml ``` <include android:id="@+id/main_right_menu_layout" android:layout_width="@dimen/width" android:layout_height="@dimen/height" layout="@layout/main_right_menu_layout" /> ```

Original source