Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding dimens.xml values of a library

Tags:

android

I have an apklib which has a dimens.xml in it with some default values, but I want to use some other values based on my use-case. Is there any approach to do this without modifying the source of the library?

like image 513
Pooya Avatar asked Apr 30 '15 11:04

Pooya


2 Answers

You don't have to touch the source code just define the values with same name in your dimens folder. When you use same name, it is always count the overridden values. I think it will work.

Another approach may work like this way, get the viewgroup/layout from your library, iterate the ChildView and change the margin/padding as your requirements.

like image 69
androidcodehunter Avatar answered Nov 15 '22 22:11

androidcodehunter


late to the party but it will probably useful for other users:

you simply need to override the value in your dimens.xml inside app/src/main/res/layout/

like image 36
Alberto M Avatar answered Nov 15 '22 23:11

Alberto M