android中的分割线

来源:互联网 发布:java 计算法定节假日 编辑:程序博客网 时间:2024/05/16 08:43

1.水平分割线

在设计android应用时,设置分隔线的方法一:

在需要设置分隔线的布局文件中加入如下代码
<View  
   android:layout_width="fill_parent"  
    android:layout_height="1px" 
   android:background="?android:attr/listDivider"  
/>  


运行实际结果如下:




2.垂直分隔线
 <View    android:layout_width="2px"    android:layout_height="fill_parent"    android:background="#008000" />
3.listView分割线

给ListView设置分割线,只需设置如下两个属性:

android:divider="#000" //设置分割线显示颜色

android:dividerHeight="1px" //此处非0,否则无效

    <ListView android:id="@+id/listView"         android:layout_width="fill_parent"        android:layout_height="fill_parent"         android:divider="#FFF"        android:dividerHeight="1px"        android:layout_margin="10dip"/>



0 0