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. adnroid(10)(android下的单元测试)
  2. Android 基础UI编程4
  3. Android 处理 Button 单击事件的三种方法
  4. Bitmap与Drawable,byte[]之间的转化
  5. android 从sdcard 读取图片 剪切 粘贴
  6. android客户端版本检测更新,服务下载,通知
  7. Android使用AsyncTask下载图片并显示进度
  8. android 自定义文字跑马灯 支持拖拽,按住
  9. Android 显示系统 --- Surface Flinger
  10. android 应用开发:android studio使用笔记