Image Buttons are used in many android applications for performing some actions. Some of the users of mobile applications sometimes are not aware of the images which are present on that specific buttons. So for informing the user about that button we also add a simple text to our button so that the user will get to know what is the use of the button. In this article, we will take a look at How to Combine Text and Image on a Button or Image Button in Android. A sample video is given below to get an idea about what we are going to do in this article.
Note: This Android article covered in both Java and Kotlin languages.
Step 1: Create a New Project in Android Studio
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio .
Step 2: Working with the activity_main.xml file
Navigate to app > res > layout > activity_main.xml and add the code below. Comments are added in the code to get to know in detail.