Hello little androids! I am back here again to explain you something that took me some time until I came up with the solution.
I wanted something like this… a TextView (the score) inside an ImageButton:
In order to put a TextView or whatever inside another layout component, you just have to think it in another way, which is overlapping.
How to overlap?
You just have to AlignRight and AlignTop the TextView with the ImageView in the xml file.
<ImageButton android:id="@+id/image_button" <!--... all the other attributes... --> /> <TextView android:id="@+id/score_electronic_devices" <!--... all the other attributes... --> android:layout_alignRight="@+id/image_button" android:layout_alignTop="@+id/image_button" />
I hope it was helpful 🙂
See you soon!