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. 大厂OPPO面试— Android(安卓)开发技术面
  2. Android属性系统(转载)
  3. Android(安卓)wifi 调试
  4. android EditText处理焦点问题和键盘收起
  5. Android(安卓)系统中 Location Service
  6. Android中的沙箱模型
  7. android各阶段目标与要求
  8. Android(安卓)Studio中Button等控件的Tex
  9. 更改android avd emulator 按键不可用
  10. Android开发——应用程序生命周期