Android--去除EditText边框,加入下划线
<span style="font-family: Arial, Helvetica, sans-serif;"><?xml version="1.0" encoding="utf-8"?> </span>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<!--注意名称 -->
<com.marine.study.LineEditText android:id="@+id/myEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="? android:attr/textViewStyle"
android:background="@null"
android:textColor="@null"
/>
</LinearLayout>
当中background,能够设置成其它颜色等
textColor不一定要是null,能够设置字体颜色
加下划线
public class LineEditText extends EditText {
// 画笔 用来画下划线
private Paint paint;
public LineEditText(Context context, AttributeSet attrs) {
super(context, attrs);
paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setColor(Color.RED);
// 开启抗锯齿 较耗内存
paint.setAntiAlias(true);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// 得到总行数
int lineCount = getLineCount();
// 得到每行的高度
int lineHeight = getLineHeight();
// 依据行数循环画线
for (int i = 0; i < lineCount; i++) {
int lineY = (i + 1) * lineHeight;
canvas.drawLine(0, lineY, this.getWidth(), lineY, paint);
}
}
}
Android--去除EditText边框,加入下划线的更多相关文章
- Android 去除EditText边框,添加下划线,
首先:重写EditText //请在这里添加您的包名 import android.content.Context; import android.graphics.Canvas; import an ...
- 隐藏android中EditText中的下划线以及修改光标颜色
在android开发中 EditTextText是我们经常用到的,我们使用时会有一些小问题,当我们点击输入文字时,EditText中的光标和下划线会变成粉红色. 解决方法很简单,我们只要在EditTe ...
- Android EditText如何去除边框添加下划线
(一)问题 之前的自定义EditText只能显示高度不超过屏幕高度的文本内容,继续增加内容会出现如下问题: (二)原因分析 下部(超出屏幕高度的部分)没有继续画线,也就是说横线没有画够,那么一定是循环 ...
- 关于android中EditText边框的问题 下划线
方法1 将edittext的style设置成?android:attr/textViewStyle 取消掉默认的样式,在设置background为@null 接下来就是一个空空的edittext了, ...
- 使用CSS去除 去掉超链接的下划线方法
我们可以用CSS语法来控制超链接的形式.颜色变化,为什么链接一定要使用下划线和颜色区分呢? 其主要原因主要是考虑到 1.视力差的人 2.色盲的人 ... 下面我们做一个这样的链接:未被点击时超链接 ...
- android ------ 高版本的 Tablayout 下划线宽度
前面呢,有写过TabLayout的博客,最近开发用到了高本版遇到一些问题,来总结一下 Android--------TabLayout实现新闻客户端顶部导航栏 Android中Tablayout设置下 ...
- Android开发之TextView的下划线添加
如何给TextView添加下划线呢,最近项目中需要这个,于是就用代码添加了下划线功能.主要就是用Paint的setFlags方法来实现,具体如下: ((TextView)mScrollView.fin ...
- android:为TextView加入样式——下划线,颜色,设置链接样式及前背景色
实现下划线及颜色设置: public class AtActivity extends Activity { LinearLayout ll; /** Called when the acti ...
- android edittext 去边框 去下划线
EditText的background属性设置为@null就搞定了:android:background="@null"style属性倒是可加可不加 附原文:@SlumberMac ...
- delphi edit边框成为下划线
设置它的几个属性:BevelEdges |_ beLeft = False; |_ beTop = False; |_ beRight = False; |_ beBott ...
随机推荐
- Kafka server.properties配置,集群部署
server.properties中所有配置参数说明(解释) broker.id =0每一个broker在集群中的唯一表示,要求是正数.当该服务器的IP地址发生改变时,broker.id没有变化,则不 ...
- mybatis 一对多
person package com.kerwin.mybatis.pojo; import java.util.List; public class Person { private int id; ...
- Bitnami 2015
WordPress WordPress is one of the world's most popular web publishing platforms for building blogs a ...
- python对象序列化或持久化的方法
http://blog.csdn.net/chen_lovelotus/article/details/7233293 一.Python对象持久化方法 目前为止,据我所知,在python中对象持久化有 ...
- 动态创建的文本框想要加上jQuery的datepicker功能变成日期选择控件该怎么办?
通常页面输入控件想得到日期选择功能,借助jQuery是这样实现的: 1.载入css和js <script src="jqueryui/jquery-ui.js" type=& ...
- Django——Django,uwsgi Nginx组合建站
近来抽时间看了点关于python的资料,试着架设了下运行环境,于是写了本文记录之. 用到的软件: Django-1.6.1 uwsgi-2.0.7 python-3.3.3 nginx-1.7.7 安 ...
- Crontab命令--Linux
Crontab命令--定时任务 命令格式 Example:
- 经验总结54--搭建linux虚拟机环境
好久没写博客了.写一篇环境搭建吧. 自己做java,有时会接触linux环境,自己能够搭建一个,方便自己做实验和学习. 1.下载VM11. 下载并依照VM:http://rj.baidu.com/so ...
- (一)Shiro笔记——简介、 架构分析
1. Shiro是什么 Apache Shiro是一个强大灵活的开源安全框架,可以完全处理身份验证,授权,企业会话管理和加密. Apache Shiro的首要目标是易于使用和理解. 安全有时可能非常复 ...
- 牛散NO.1:MACD计啜诱多,勾魂枪连环夺命时
上证日线“连环夺命勾魂枪” 话说MACD中圈C的回勾,好事者皆认为新的冲击波即将曙光再现.伴随着K线出现红柱中阳,更多的投资者将会被这一勾诱惑得群情亢奋,盲断行情又要 起来了.但往往事与愿违,“潘金莲 ...