android - Quick way to add hundreds of items to an XML <animation-list> element -


i have add 100 .png's create animationdrawable on android.

luckily, png's named in ascending order (p1, p2, p3, p4).

manually adding pngs xml element painfully slow, i'm wondering if there's way automatically 'increment' filename limit.

the method not have use android studio. text manipulation program do. below example of desired result:

<animation-list android:id="@+id/selected" android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/p1" android:duration="500" /> <item android:drawable="@drawable/p2" android:duration="500" /> <item android:drawable="@drawable/p3" android:duration="500" /> <item android:drawable="@drawable/p4" android:duration="500" /> ... ... ... <item android:drawable="@drawable/p99" android:duration="500" />   </animation-list> 

  • create sequence 1 99 in ms excel/apple numbers/google sheets
  • copy entire sequence favorite text editor
  • search regex new lines (\n)
  • using sublime or atom, press alt + enter
  • move start of line paste item android:drawable="@drawable/p
  • now, move end of line , paste " android:duration="500" />

Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

Ansible warning on jinja2 braces on when -