Android 一条竖线或横线、画边框

1、画线
[img]
http://pic002.cnblogs.com/images/2010/122963/2010122216290992.png
[/img]

如果是LinearLayout布局,必须要在<View/>的属性里面指定宽和高两个属性,否则就会出错,如果是TableLayout布局,只需要指定高这个属性就可以了

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:autoLink="all"
        android:text="博客:http://www.baidu.com" />

    <TextView
        android:id="@+id/myTextView01"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/str_textview01" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="2dip"
        android:background="#FF909090" />

    <TextView
        android:id="@+id/myTextView02"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/str_textview02" />

    <View
        android:layout_width="fill_parent"
        android:layout_height="2dip" />

</LinearLayout>


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

2、边框
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="#FFFFFF" />

    <stroke
        android:width="1dp"
        android:color="#000000" />

    <padding
        android:bottom="1dp"
        android:left="1dp"
        android:right="1dp"
        android:top="1dp" />

</shape>


<LinearLayout
    android:id="@+id/completed_wrap"
    android:layout_width="33dip"
    android:layout_height="wrap_content"
    android:background="@drawable/border"
    android:gravity="center"
    android:orientation="horizontal" >

</LinearLayout>

原文 [url]http://blog.csdn.net/hlily2005/article/details/6005969[/url]

你可能感兴趣的:(android,shape)