Can I do the calculations inside the variable.xml?

I am just wondering if I can do some calculations inside of the dimensions.xml? I tried but not working:

diameter.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" /> 
+8
android
source share
2 answers

Not. Resources are allowed for both the device and its orientation. Therefore, you cannot use links to other resources and have calculations on them in a dimens.xml .

+4
source share

Not. This cannot be done in xml. But this can be done using java code.

0
source share

All Articles