【转】解决EditText边框问题,无需用图作背景,更无需自绘

来源:互联网 发布:淘宝客怎么开通教程 编辑:程序博客网 时间:2024/05/19 10:37
转自:http://www.apkbus.com/android-131242-1-1.html

之前发现设置"AndroidManifest.xml"的主题会引起组件样式问题
设置成android:theme="@android:style/Theme.NoTitleBar" EditText组件为带边框的
 
设置成android:theme="@style/AppTheme" EditText组件为不带边框的
 
研究了一下午,在网上查了很多资料
通常做法有两种:

一种是网上比较推崇的用图作背景,另一种则是自绘

具体看文章:

http://blog.csdn.net/zhangzhikaixinya/article/details/7829729

其实还有另外种做法通过XML形式:



  1. <P style="LINE-HEIGHT: 20px; FONT-FAMILY: Georgia; LETTER-SPACING: 2px; COLOR: rgb(147,141,111)"><SPAN style="BACKGROUND-COLOR: rgb(255,255,255)"><FONT color=black size=3><EditText
  2.                         android:layout_width="wrap_content"
  3.                         android:layout_height="wrap_content"
  4.                         android:background="@drawable/public_normal_edittext"
  5.                         android:drawableLeft="@drawable/public_call_img_normal"
  6.                         android:drawablePadding="10dp"
  7.                         android:hint="@string/stylist_txt_ndch"
  8.                         android:inputType="textPersonName"
  9.                         android:singleLine="true" /></FONT></SPAN></P>
复制代码

android:drawableLeft="@drawable/public_call_img_normal"

@string/stylist_txt_ndch

最后效果如图:

http://liuzhichao.com/p/612.html


各位可以去掉,另外要引入一个“public_normal_edittext.xml”下附件

密码微博私信我

http://weibo.com/henrymobilenet?topnav=1&wvr=5

背景图片

public_normal_edittext.rar

626 Bytes, 下载次数: 57, 下载积分: 下载豆 -2

0 0
原创粉丝点击