※效果

※简介
定义控件间的分隔符,下面简绍两种方法。
※方法一
第一种是比较常用的,在控件直接定义View
插入控件直接即可<
View
android:layout_height
=
"fill_parent"
android:layout_width
=
"1dp"
android:background
=
"#90909090"
android:layout_marginBottom
=
"5dp"
android:layout_marginTop
=
"5dp"
/>
※方法二
这个是在API live 11+出现的,首先定义一个separator.xml的drawable文件
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
shape
xmlns:android
=
"http://schemas.android.com/apk/res/android"
>
<
size
android:width
=
"1dp"
/>
<
solid
android:color
=
"#90909090"
/>
</
shape
>
在LinearLayout中定义分割符属性
<
LinearLayout
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
android:adjustViewBounds
=
"true"
android:divider
=
"@drawable/separator"
android:showDividers
=
"middle"
android:dividerPadding
=
"5dp"
android:orientation
=
"horizontal"
>
<
Button
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
style
=
"?android:attr/buttonBarButtonStyle"
android:text
=
"Yes"
android:layout_weight
=
"1"
android:id
=
"@+id/button1"
android:textColor
=
"#00b0e4"
/>
<
Button
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
style
=
"?android:attr/buttonBarButtonStyle"
android:text
=
"No"
android:layout_weight
=
"1"
android:id
=
"@+id/button2"
android:textColor
=
"#00b0e4"
/>
<
Button
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
style
=
"?android:attr/buttonBarButtonStyle"
android:text
=
"Neutral"
android:layout_weight
=
"1"
android:id
=
"@+id/button3"
android:textColor
=
"#00b0e4"
/>
</
LinearLayout
>