在显示的视图中加一条间隔线,不像ListView里面的那种虚线,而是一条实线
如果是LinearLayout布局,必须要在<View/>的属性里面指定宽和高两个属性,否则就会出错,如果是TableLayout布局,只需要指定高这个属性就可以了
xml布局如下:
![ContractedBlock.gif](https://i-blog.csdnimg.cn/blog_migrate/8f900a89c6347c561fdf2122f13be562.gif)
![ExpandedBlockStart.gif](https://i-blog.csdnimg.cn/blog_migrate/961ddebeb323a10fe0623af514929fc1.gif)
<?
xml version="1.0" encoding="utf-8"
?>
< LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android"
android:orientation ="vertical"
android:layout_width ="fill_parent"
android:layout_height ="fill_parent"
>
< 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 >
< LinearLayout xmlns:android ="http://schemas.android.com/apk/res/android"
android:orientation ="vertical"
android:layout_width ="fill_parent"
android:layout_height ="fill_parent"
>
< 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 >