像这样的分隔符,通常我们首先想到的是用两个1px的View去做分隔符,在API 11 (Android )以及之后,又更人性的实现方式

1.separator.xml

<?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>

2.在布局中使用

<LinearLayout    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:adjustViewBounds="true"    android:divider="@drawable/separator"    android:showDividers="middle"    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>

来源:http://envyandroid.com/archives/1193/view-separators?utm_source=Android+Weekly&utm_campaign=ac89b26b9e-Android_Weekly_107&utm_medium=email&utm_term=0_4eb677ad19-ac89b26b9e-337843225

更多相关文章

  1. Android开发入门之学习笔记(四):程序窗口的布局(二)
  2. Android常用布局组件----重新认识Android(3)
  3. Eclipse 默认打开Android xml 布局
  4. 布局使用selector不变色问题
  5. android 界面布局 很好的一篇总结
  6. Android 相对布局(Relative Layout)
  7. Android弹性收缩自适应布局FlexboxLayout
  8. Android布局(layout)

随机推荐

  1. Android(安卓)长按识别图中二维码 zxing
  2. Android.mk 代码注释
  3. S5PV210 Android(安卓)fimc驱动分析 - fi
  4. 关于Android中res等几种文件通过InputStr
  5. android自制拨号器
  6. Android(安卓)编译基础知识
  7. android广播的两种方式!
  8. Android(安卓)studio 2 版本升级 Android
  9. Android(安卓)JSON数据与实体类之间的相
  10. Android(安卓)getevent命令分析Input事件