I want to display 4 texts with images exactly like showed in this screenshot:
Notice the 4 texts at the buttom of the image, with the icons next to them.
My question is how do I do it, I mean, how do I attach an icon to each text field and display it symmetrically at the bottom of the page.
I want to position my texts with the icons exactly like this example.
Thanks for your help, it's a really great exercise for a newbie :)
Dvir
Use
drawableLeft
for thisOR
In java code
You can just use a
TextView
, and add for exampleandroid:drawableLeft="@drawable/your_icon"
Use left/right depending of where you want your icon.Ideal approach to implement this would be:
add below function to your code as well:
This way your can set/choose/resize your text-icons appropriately(by adjusting the value of form-factor) which is not possible when done through xml.
NOTE: I've written above function for square-drawables, for rectangular images we will have to do
setBounds
accordingly.