Android App Development button displays two lines of text

Source: Internet
Author: User

I wrote a phone dialer program for a boyfriend to play, used to hit my mobile phone number, in order to make the interface look good, you need to display two lines of text button. Two methods were collected on the internet and recorded in the following. To share with you, hoping to help the people who need it.

method One:

<linearlayout

Android:id= "@+id/container"

Android:layout_width= "Wrap_content"

android:layout_height= "Wrap_content"

tools:context= "Com.example.test.MainActivity"

Tools:ignore= "Mergerootframe"

android:clickable= "true"

android:focusable= "true"

android:orientation= "Vertical"

android:background= "@android:d rawable/btn_default">

<textview

android:text= "Hello"

Android:layout_width= "Wrap_content"

Android:gravity= "Center_horizontal"

android:layout_height= "Wrap_content"

android:layout_weight= "1"/>

<textview

Android:text= "Android"

Android:layout_width= "Wrap_content"

android:layout_height= "Wrap_content"

Android:layout_gravity= "Center_horizontal"

android:layout_weight= "1"/>

</LinearLayout>

effects such as:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvbglhbmdjywl5dw4ymdez/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma== /dissolve/70/gravity/center ">

Because I was just beginning to learn, with such a method when did not think of the way to bind the listener, hoping to pass the great God pointing twos.

Method Two:

<buttton

Android:id= "@+id/button1"

Android:layout_width= "Wrap_content"

android:layout_height= "Wrap_content"

Android:textcolor= "#FF0000"

Android:textsize= "20SP"

android:text= "Call the girl & #10; (China Unicom) "/>

The way to do this is with "& #10;" This symbol implements a button that displays two lines of text so that the listener can be bound to the button

However, when used, it is assumed that both ends of the symbol are "@string/..." and an error is made.

This is a note. I hope to be useful to you



Android App Development button displays two lines of text

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.