Implement rounded border and Android rounded border in the android Layout

Source: Internet
Author: User

Implement rounded border and Android rounded border in the android Layout
Set corners_bg.xml to set the border rounded corner. You can define an xml: [html] In the drawable-mdpi directory. <? Xml version = "1.0" encoding = "UTF-8"?> <Shape xmlns: android = "http://schemas.android.com/apk/res/android"> <solid android: color = "# FFFFFF"/> <corners android: topLeftRadius = "10dp" android: topRightRadius = "10dp" android: bottomRightRadius = "10dp" android: bottomLeftRadius = "10dp"/> </shape> explanation: solid indicates the fill color. For simplicity, the white color is used here. Corners indicates the rounded corner. Note that bottomRightRadius is in the lower left rather than the lower right corner, and bottomLeftRadius is in the lower right corner. The above effects can also be set as follows: [html] <corners android: radius = "5dp"/> reference corners_bg.xml if you want to reference this xml, just @ drawable/corners_bg.xml: [html] view plaincopyandroid: background = "@ drawable/corners_bg" application example [html] <? 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: background = "# E1E0DE" android: orientation = "vertical"> <TextView android: id = "@ + id/textView1" android: layout_width = "match_parent" android: layout_height = "50dp" android: background = "#2B3439" android: gravity = "center" android: text = "found" android: textColor = "# FFFFFF" android: textSize = "20sp"/> <LinearLayout android: id = "@ + id/login_div" android: layout_width = "fill_parent" android: layout_height = "50dp" android: layout_margin = "10dp" android: background = "@ drawable/corners_bg" android: gravity = "center_vertical" android: padding = "10dp"> <ImageView android: id = "@ + id/imageView1" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: src = "@ drawable/find_more_friend_photograph_icon"/> <TextView android: id = "@ + id/textView2" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "14dp" android: text = "" android: textColor = "#000" android: textSize = "18sp"/> </LinearLayout> <LinearLayout android: layout_width = "fill_parent" android: layout_height = "101dp" android: layout_margin = "10dp" android: background = "@ drawable/corners_bg" android: orientation = "vertical" android: padding = "10dp"> <LinearLayout android: layout_width = "wrap_content" android: layout_height = "50dp"> <ImageView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: src = "@ drawable/find_more_friend_scan"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "14dp" android: text = "scan" android: textColor = "#000" android: textSize = "18sp"/> </LinearLayout> <LinearLayout android: layout_width = "wrap_content" android: layout_height = "50dp" android: layout_centerVertical = "true"> <ImageView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: src = "@ drawable/come_from_shake"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "14dp" android: text = "Shake" android: textColor = "#000" android: textSize = "18sp"/> </LinearLayout> <LinearLayout android: layout_width = "fill_parent" android: layout_height = "101dp" android: layout_margin = "10dp" android: background = "@ drawable/corners_bg" android: orientation = "vertical" android: padding = "10dp"> <LinearLayout android: layout_width = "wrap_content" android: layout_height = "50dp"> <ImageView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: src = "@ drawable/find_more_friend_near_icon"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "14dp" android: text = "nearby" android: textColor = "#000" android: textSize = "18sp"/> </LinearLayout> <LinearLayout android: layout_width = "wrap_content" android: layout_height = "50dp" android: layout_centerVertical = "true"> <ImageView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: src = "@ drawable/come_from_bottle"/> <TextView android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "14dp" android: text = "float bottle" android: textColor = "#000" android: textSize = "18sp"/> </LinearLayout> <LinearLayout android: id = "@ + id/login_div" android: layout_width = "fill_parent" android: layout_height = "50dp" android: layout_margin = "10dp" android: background = "@ drawable/corners_bg" android: gravity = "center_vertical" android: padding = "10dp"> <ImageView android: id = "@ + id/imageView1" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: src = "@ drawable/more_game"/> <TextView android: id = "@ + id/textView2" android: layout_width = "wrap_content" android: layout_height = "wrap_content" android: layout_marginLeft = "14dp" android: text = "Game Center" android: textColor = "#000" android: textSize = "18sp"/> </LinearLayout>

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.