Android a vertical or horizontal line, draw a border

Source: Internet
Author: User

Android a vertical or horizontal line, draw a border Blog Category:
    • Android
Androidshape 1, Draw line
[img]
Http://pic002.cnblogs.com/images/2010/122963/2010122216290992.png
[/IMG]

If it is a linearlayout layout, you must specify the width and height of the <View/> property inside the two properties, otherwise it will be wrong, if it is the tablelayout layout, only need to specify the high this property can be

XML code
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:orientation="vertical" >
  6. <TextView
  7. android:id="@+id/textview01"
  8. android:layout_width="fill_parent"
  9. android:layout_height="wrap_content"
  10. android:autolink="All"
  11. android:text="blog: http://www.baidu.com" />
  12. <TextView
  13. android:id="@+id/mytextview01"
  14. android:layout_width="fill_parent"
  15. android:layout_height="wrap_content"
  16. android:text="@string/str_textview01" />
  17. <View
  18. android:layout_width="fill_parent"
  19. android:layout_height="2dip"
  20. android:background="#FF909090" />
  21. <TextView
  22. android:id="@+id/mytextview02"
  23. android:layout_width="fill_parent"
  24. android:layout_height="wrap_content"
  25. android:text="@string/str_textview02" />
  26. <View
  27. android:layout_width="fill_parent"
  28. android:layout_height="2dip" />
  29. </linearlayout>


Original http://www.cnblogs.com/snowdrop/articles/1914010.html

2. Border
XML code
  1. <? XML version= "1.0" encoding="UTF-8"?>
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >
  3. <solid android:color="#FFFFFF" />
  4. <stroke
  5. android:width="1DP"
  6. android:color="#000000" />
  7. <padding
  8. android:bottom="1DP"
  9. android:left="1DP"
  10. android:right="1DP"
  11. android:top="1DP" />
  12. </shape>


XML code
  1. <LinearLayout
  2. android:id="@+id/completed_wrap"
  3. android:layout_width="33dip"
  4. android:layout_height="wrap_content"
  5. android:background="@drawable/border"
  6. android:gravity="center"
  7. android:orientation="Horizontal" >
  8. </linearlayout>
  9. Original [Url]http://blog.csdn.net/hlily2005/article/details/6005969[/url]

Android a vertical or horizontal line, draw a border

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.