Two texts in a button, title and subtitles

Can we create a custom button with a caption and caption text.

The title is at the top of the button and subtitle below.

+5
source share
3 answers

Here is the answer:)

You don’t need the images you need, it is stylized text and here is a simple and short way to do it

button1.setText(Html.fromHtml("<b><big>" + "Title" + "</big></b>" +  "<br />" + 
        "<small>" + "subtitle" + "</small>" + "<br />"));

You do not need to change any layout, just add this text to your button

+26
source

you can solve this problem logically, the logic is this.

android:text="Titel \n subTitle"

I hope this helps you.

0
source

XML .

, .

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">


<Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="25dp"
    android:id="@+id/button"
    android:text="Text1" />
<TextView
    android:id="@+id/label"
    android:layout_alignBottom="@id/button"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Text2"/>
</RelativeLayout>
-1

All Articles