In android 2.2 you could do the following.

Create an xml drawable such as /res/drawable/textlines.xml and assign this as a TextView's background property.

<TextViewandroid:text="My text with lines above and below"android:background="@drawable/textlines"/>

/res/drawable/textlines.xml

<?xml version="1.0" encoding="utf-8"?><layer-list xmlns:android="http://schemas.android.com/apk/res/android" >    <item>      <shape         android:shape="rectangle">            <stroke android:width="1dp" android:color="#FF000000" />            <solid android:color="#FFDDDDDD" />        </shape>   </item>   <item android:top="1dp" android:bottom="1dp">       <shape         android:shape="rectangle">            <stroke android:width="1dp" android:color="#FFDDDDDD" />            <solid android:color="#00000000" />        </shape>   </item></layer-list>

The down side to this is that you have to specify an opaque background colour, as tranparencies wont work. (At least i thought they did but i was mistaken). In the above example you can see that the solid colour of the first shape #FFdddddd is copied in the 2nd shapes stroke colour

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android实现信息安全中维吉尼亚密码技术
  2. Android(安卓)Studio导入jar后无法识别、
  3. Android开发--自定义颜色渐变的标题栏简
  4. Android高效ImageLoader的实现
  5. 五种方式实现Android底部导航栏
  6. android中对apk文件反编译的方法(详细)
  7. Android开发-UI开发
  8. 用Basic开发Android的应用.Basic4Android
  9. Android(安卓)源码分析之旅3.4--onConfig
  10. Android(安卓)自定义底部导航栏和动态添