How to create a button with a fontawesome string as "icon" and normal text as label in Android?

Giuseppe Ronca

I'm trying to create a button with a fontawesome string as "icon" and normal text as label in Android

Currently i'm using this ( in dashboard.xml ):

<Button
       android:id="@+id/ndc"
       style="?android:attr/borderlessButtonStyle"
       android:layout_width="0dip"
       android:layout_height="wrap_content"
       android:layout_weight="1"
       android:background="@android:color/transparent"
       android:text="@string/icon_ndc"
       android:textColor="#FFFFFF" 
       android:shadowColor="#000000"
       android:shadowDx="1"
       android:shadowDy="1"
       android:shadowRadius="1"
/>

and this ( in strings.xml , it's a fontawesome icon)

<string name="icon_ndc">&#xf19c;</string>

How can i add a label that must have different size , color etc?

JavaGhost

You can use SpannableString as text to the button. With that you can set different font based on start-end index within the string. Refer

You can alternatively use Iconify library for easy usages of font awesome across other widgets and with animation!!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

OpeneERP: How to create a button with no icon (only text on it)

From Java

Android button with icon and text

From Dev

Create icon button - Android

From Dev

How to create a link button with a icon and button description text

From Dev

Unicode label is not displayed as a Fontawesome icon

From Dev

Android background + text + icon for a button

From Dev

Android Text Below Icon (button)

From Dev

Android Text Below Icon (button)

From Dev

Tooltip not displaying on fontawesome icon button

From Dev

how to display the text message inside the fontawesome square icon

From Dev

how to create label button in PYQT?

From Dev

how to create label button in PYQT?

From Dev

Placing text inside fontawesome icon

From Dev

Change FontAwesome icon with text on hover

From Dev

Align Text Beside FontAwesome Icon

From Dev

Vertical alignment on text and fontawesome icon

From Dev

How to create a Label with close icon in Bootstrap?

From Dev

Convert string to FontAwesome icon and assign to icon field

From Dev

Android - Text overlays icon on toggle button

From Dev

Android Button: multiple shapes and icon + text

From Dev

How to create a spinning icon in android

From Dev

Rails: how to use fontawesome icon

From Dev

FontAwesome.UWP icon inside a button

From Dev

How to center icon and text inside of a button?

From Dev

How to display icon in button's text

From Dev

How to display icon in button's text

From Dev

How to create a large Blueprint button with a large icon?

From Dev

How to vertical align icon inside label and button in the same way

From Dev

How to get a pseudoelement after the label of a paper-icon-button

Related Related

HotTag

Archive