`
marine8888
  • 浏览: 540146 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

Android--为TextView添加边框

阅读更多

  textview加边框 收藏
方法一:

 


比较土  ,加背景图片,透明的带边框的背景图片

设置到android:background就可以

 


方法二:

 


刚学到的

android:background的值是一个xml文件

 


yle="font-family: mceinline;">TextView的xml:

 


<TextView android:id="@+id/roomInfo"

android:layout_centerHorizontal="true"

android:textSize="24dip"

android:layout_height="wrap_content"

android:gravity="center"

android:layout_alignParentRight="true"

android:textColor="@color/solid_black"

android:background="@drawable/setbar_bg"

android:layout_marginLeft="10dip"

android:layout_marginTop="5dip"

android:layout_width="300dip">

</TextView>

 


setbar_bg.xml 放在drawable-hdpi文件夹下面

 


<?xml version="1.0" encoding="UTF-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <solid android:color="#00000000"/>

    <stroke android:width="2dip" android:color="#ff000000" />

</shape>


本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/zhanghw0917/archive/2010/06/01/5639065.aspx

分享到:
评论
2 楼 TienYow 2014-04-28  
学习了,但怎么设置单向边框呢?比如下边框,上边框!
1 楼 japankn 2012-10-11  
好使,谢谢

相关推荐

Global site tag (gtag.js) - Google Analytics