Android buttons with text shadow and android shadow

Source: Internet
Author: User

Android buttons with text shadow and android shadow

<? Xml version = "1.0" encoding = "UTF-8"?> <LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: layout_width = "match_parent" android: layout_height = "match_parent" android: orientation = "vertical"> <! -- Text shadow Button --> <Button android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: text = "text shadow Button" android: textSize = "12sp" android: shadowColor = "# aa5" android: shadowRadius = "1" android: shadowDx = "5" android: shadowDy = "5"/> </LinearLayout>


Android: How to center text under a button?

Add a horizontal center property under TextView: android: layout_centerHorizontal = "true"
<LinearLayout
Android: layout_width = "match_parent"
Android: layout_height = "match_parent"
Android: orientation = "horizontal">

<RelativeLayout
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1">

<Button
Android: id = "@ + id/btn1"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_centerHorizontal = "true"/>

<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/btn1"
Android: layout_centerHorizontal = "true"
Android: text = "aaaaaa"/>
</RelativeLayout>

<RelativeLayout
Android: layout_width = "0dp"
Android: layout_height = "wrap_content"
Android: layout_weight = "1">

<Button
Android: id = "@ + id/btn2"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_centerHorizontal = "true"/>

<TextView
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/btn2"
Android: layout_centerHorizontal = "true"
Android: text = "bbbbbbb" & # ...... remaining full text>

In android development, why are these attributes set for text on my image buttons not centered?

The code is okay. It may be. 9. the area to be displayed in the image is not long-width symmetric. I used to encounter this problem. You can change it. if the problem is solved, it must be. why is the image

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.