Domanda

Is it possible to use the reference of a dimension resource in another dimension? What i mean is something like this:

File dimen.xml:

<dimen name="test1">18sp</dimen>
<dimen name="test2">@dimen/test1</dimen>
È stato utile?

Soluzione

It works the way i posted

<dimen name="test1">18sp</dimen>
<dimen name="test2">@dimen/test1</dimen>

Altri suggerimenti

I would suggest to consider one more thing when using this. I get what you said in your comment, but either there is a link between the two values or there is not and you should distinguish between these two possibilities.

If there is no link between test1 and test2 and they are independent and the fact that they hold the same value is mere coincidence, then you shouldnt suggest a link between the two. Instead just set the same value twice.

Why do you want create a second dimension with the same value as first ?

Don't create second dimension, but use first !

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top