I wanted to have a drawable resource that features a row of circles, with one of them in solid background similiar to this (refer to the row of circles at the bottom). I wanted to show an animation of it going from left to right, and having a drawable resource is the first step of achieving it. How can I do that. thanks
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I use a TextView to which five strings (I have 5 steps) all composed with Unicode characters (\u26cb for the empty circle) and (\u26cf for the filled circle).
Like this (i stored them in my res/values/arrays.xml file):
So, when the array is loaded, I can set the TextView's text easily basing upon the current step.
[EDIT]
As you probably know, Unicode characters ar not only "characters"... you can have some graphic icons (glyphs).
Among these, you find circles (filled and empty).
The first line in the array DRAWS a filled circle followed by 4 empty circles.
The second line DRAWS an empty circle, a filled circle and 3 empty circles, and so on.
To "animate" the row, just pass your TextView the next element in the array. as its text.
[EDIT]
Here's an emulated ldpi device screen showing step 2 of 5 in the process.
This is the second array element.
Bottom part of the screen
[EDIT]
Why did I choose text instead of images?
Because it is:
light (a ttf font is vectorial graphics),
scalable (I don't have to provide several PNGs for different screen resolutions),
easy (read the array once, and set a TextView's text accordingly),
maintainable (should I add or remove some steps, it's just a matter of modifying the string array accordingly)
You can use Jake Wharton's ViewPagerIndicator to add the titles or simple circles for each tab in your ViewPager.
The supplied sample code on GitHub
You can also use the ViewPager and PageIndicator of Greendroid library
Check out the ViewPagerIndicator Tutorial
you can take image of circle like in the above image and then set image in imageview place horizontally just like in the above image.