Android 一條豎線或橫線、畫邊框

來源:互聯網
上載者:User

標籤:

Android 一條豎線或橫線、畫邊框部落格分類:
     
  • android
androidshape 1、畫線 
[img] 
http://pic002.cnblogs.com/images/2010/122963/2010122216290992.png 
[/img] 

如果是LinearLayout布局,必須要在<View/>的屬性裡面指定寬和高兩個屬性,否則就會出錯,如果是TableLayout布局,只需要指定高這個屬性就可以了 

Xml代碼  
  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.   
  7.     <TextView  
  8.         android:id="@+id/textView01"  
  9.         android:layout_width="fill_parent"  
  10.         android:layout_height="wrap_content"  
  11.         android:autoLink="all"  
  12.         android:text="部落格:http://www.baidu.com" />  
  13.   
  14.     <TextView  
  15.         android:id="@+id/myTextView01"  
  16.         android:layout_width="fill_parent"  
  17.         android:layout_height="wrap_content"  
  18.         android:text="@string/str_textview01" />  
  19.   
  20.     <View  
  21.         android:layout_width="fill_parent"  
  22.         android:layout_height="2dip"  
  23.         android:background="#FF909090" />  
  24.   
  25.     <TextView  
  26.         android:id="@+id/myTextView02"  
  27.         android:layout_width="fill_parent"  
  28.         android:layout_height="wrap_content"  
  29.         android:text="@string/str_textview02" />  
  30.   
  31.     <View  
  32.         android:layout_width="fill_parent"  
  33.         android:layout_height="2dip" />  
  34.   
  35. </LinearLayout>  


原文 http://www.cnblogs.com/snowdrop/articles/1914010.html 

2、邊框 
Xml代碼  
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <shape xmlns:android="http://schemas.android.com/apk/res/android" >  
  3.   
  4.     <solid android:color="#FFFFFF" />  
  5.   
  6.     <stroke  
  7.         android:width="1dp"  
  8.         android:color="#000000" />  
  9.   
  10.     <padding  
  11.         android:bottom="1dp"  
  12.         android:left="1dp"  
  13.         android:right="1dp"  
  14.         android:top="1dp" />  
  15.   
  16. </shape>  


Xml代碼  
  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.   
  9. </LinearLayout>  
  10.   
  11. 原文 [url]http://blog.csdn.net/hlily2005/article/details/6005969[/url]  
 

Android 一條豎線或橫線、畫邊框

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.