Hi Folks, we usually utilise dimens.xml file for reusability across diff screens based upon some constraints like os version, screen size, etc.
Can we create multiple dimens xml file but decide during runtime which dimens xml file to use based upon custom conditions?
@Jeff Lockhart thanks, bt this only considers pre defined conditions such as screen size. I am looking more like : if(some condition) then flavor1/dimens else flavor2/dimens
j
Jeff Lockhart
06/13/2023, 4:29 PM
Oh, I didn't fully read your question. No, I don't believe you can manually select which file is provided, as the
Context
determines what it returns.
Jeff Lockhart
06/13/2023, 6:40 PM
I'd just create the possible dimensions as separate values in the XML and then your logic will access whichever one you need.