I have got lots of XML files in which margin and padding dimensions are hardcode I have to replace all of them in format @denem/margin_20 ....etc
I have made dimens and saved all the values I need. But I have lots of XML files it will take a lot of time for me to go and change one by one file manually SO I want to ask is there any trick to change all the values at once in Android Studio.
Thanks a lot for Helping.
Press Ctrl
+ Shift
+ R
to replace and write "50dp"
with inverted commas in find field . Then in replace field write @dimen/_50dp
. Replace one occurrence and if it worked as expected and replace all other occurrences.
NOTE: if you want to change this in just res
folder then you can select this folder only in find and replace dialog.
The approved answer is good but then you will have to do it one by one for each dimension so you can do the following:
Ctrl
+ Shift
+ R
to replace all.It will replace all 2 digits and 1 digit dp values to dimension. You will manually need to edit negative and floating dp values.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.