手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android利用xml实现分割线
android利用xml实现分割线
摘要:因为没有美工,所以只能自己动手了。在layout文件夹里的xml写方法1:在layout里面的布局xml文件里加上面的代码效果图在drawa...

因为没有美工, 所以只能自己动手了。

在layout文件夹里的xml 写

方法1:在layout里面的布局xml 文件里加上面的代码

<View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/orange_normal" />

效果图

android利用xml实现分割线1

在drawable文件夹里用 shape line 或 rectangle 先画线

方法2:在drawable里面用shape新建一个xml

然后在 layout 里的布局文件里引用

这种方法 可以 多处引用同一个 line 样式

<> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <stroke android:color="@color/orange_normal" /> </shape>

或者用填充的矩形实现

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <solid android:color="@color/orange_normal" /> <size android:height="1dp" android:width="100dp" /> </shape>

Note

android:width=”100dp” 不能赋值为 “match_parent”

在layout/bomb_fragment.xml 里面引用

<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/line_my" />

希望本文所述对大家学习Android软件编程有所帮助。

【android利用xml实现分割线】相关文章:

android开发中常用的Eclipse快捷键详细整理

Android仿QQ空间主页面的实现

设置android 文字下划线

android webview 简单浏览器实现代码

android生命周期深入分析(二)

Android HTTP 实现与服务器通信

Android实现发短信/彩信功能

android Setting中隐藏项实现原理与代码

Android动画之3D翻转效果实现函数分析

Android调用google地图生成路线图实现代码

精品推荐
分类导航