Android Text icon below (button)

I am trying to create a master record interface. I will create six buttons and each button will open a different action. For each button, I want her to have a large icon with text below the button. Currently, I may have an image on the button, but I don’t know how to make the text appear below the button. I tried to place the text directly on the image, but it does not look very good. Here is the part for the first line (two buttons) of the button

<LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="horizontal" android:weightSum="2" > <Button android:id="@+id/btn1" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/ic_my_icon" /> <Button android:id="@+id/btn2" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/ic_my_icon2" /> </LinearLayout> 

This is what I am talking about. Other than that, I want the icon to be an oval button. As a result, I want the image to look like the image in this post, except that I would like six oval buttons with images and text. Round buttons with an icon in the center and text below the icon

Many thanks for your help.

+7
android text button
source share
1 answer

Use the drawableTop attribute as follows:

 <Button android:id="@+id/btn2" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:text="This text is below the image" android:drawableTop="@drawable/ic_my_icon2" /> 

See the android:drawableTop and this simple example in button documentation with drawableLeft .

+13
source share

All Articles