设置TextView的密码效果以及跑马灯效果
密码效果以及跑马灯效果:
xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <CheckBox
android:id="@+id/chk_01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="保存账号及密码" /> <EditText
android:id="@+id/et_logName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Please input your LogName" /> <EditText
android:id="@+id/et_logPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Please input your PassWord" /> <Button
android:id="@+id/btn_save"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="保存" /> <com.wyl.fragementtest.MaqueeText
android:id="@+id/tv_01_pmd"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:singleLine="true"
android:text="将文本框的内容以明文显示:editText1.setTransformationMethod(HideReturnsTransformationMethod.getInstance());" /> <com.wyl.fragementtest.MaqueeText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="editText1.setTransformationMethod(PasswordTransformationMethod.getInstance());//将文本框的内容以密码显示" /> <com.wyl.fragementtest.MaqueeText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="false"
android:text="将文本框的内容以密码显示:editText1.setTransformationMethod(PasswordTransformationMethod.getInstance());将文本框的内容以明文显示:editText1.setTransformationMethod(HideReturnsTransformationMethod.getInstance());" /> </LinearLayout>
MaqueeText.java
package com.wyl.fragementtest; import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView; public class MaqueeText extends TextView{ public MaqueeText(Context context) {
super(context);
// TODO Auto-generated constructor stub
} public MaqueeText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
} public MaqueeText(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
@Override
public boolean isFocused() {
//返回true,表示MaqueeText控件活的焦点,只有获得了焦点textView才会有跑马灯效果
return true;
}
}
设置TextView的密码效果以及跑马灯效果的更多相关文章
- Android开发:文本控件详解——TextView(二)文字跑马灯效果实现
一.需要使用的属性: 1.android:ellipsize 作用:若文字过长,控制该控件如何显示. 对于同样的文字“Android开发:文本控件详解——TextView(二)文字跑马灯效果实现”,不 ...
- TextView标签的属性和跑马灯效果
text:显示的内容 textSize:文本的大小 textColor:文本的颜色 visibility:可见性 默认可见,invisible:表示不可见,但对控件的显示区域做了保留 gone:隐藏 ...
- Textview在Listview中实现跑马灯效果
textview添加属性: android:singleLine="true" 表示单行显示 android:ellipsize="marquee" 设 ...
- android 怎么实现跑马灯效果
自定义控件 FocusedTextView, 使android系统误以为它拥有焦点 public class FocusedTextView extends TextView { public Foc ...
- android实现跑马灯效果(能够实现两个以上跑马灯)
本文用了继承自TextView的MarqueeTextView来实现跑马灯效果.原因是,跑马灯效果是须要TextView拥有焦点才会跑动的.而有时候TextView获得焦点会有点耗时,造成要等待一段时 ...
- iOS中跑马灯效果小结
时光过得好快,记忆中刚刚从春节返回没有多久,清明.五一已飞逝而过,眨眼已到盛夏季节.不过还好,济南这两年不算太热,刚开始升温几天,一场及时雨总能让温度保持适宜.为了纪念一下青春的尾巴,也为了能有个健康 ...
- TextView跑马灯效果
转载:http://www.2cto.com/kf/201409/330658.html 一.只想让TextView显示一行,但是文字超过TextView的长度怎么办?在开头显示省略号 android ...
- [Android1.5]TextView跑马灯效果
from: http://www.cnblogs.com/over140/archive/2010/08/20/1804770.html 前言 这个效果在两周前搜索过,网上倒是有转载,可恨的是转载之后 ...
- 【Android】TextView跑马灯效果
老规矩,先上图看效果. 说明 TextView的跑马灯效果也就是指当你只想让TextView单行显示,可是文本内容却又超过一行时,自动从左往右慢慢滑动显示的效果就叫跑马灯效果. 其实,TextView ...
随机推荐
- bzoj 1047 : [HAOI2007]理想的正方形 单调队列dp
题目链接 1047: [HAOI2007]理想的正方形 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 2369 Solved: 1266[Submi ...
- codeforces 626E. Simple Skewness 三分
题目链接 给n个数, 让你去掉一些数, 使得剩下的数的平均值-中位数的差值最大. 先将数组排序, 然后枚举每一个数作为中位数的情况, 对于每个枚举的数, 三分它的左右区间长度找到一个平均值最大的情况, ...
- Sublime Text3安装SublimeREPL插件以及快捷键设置
SublimeREPL是Sublime Text的一个插件,它除了可以使你在ST中运行解释器(REPL),还有对Python语言的特别支持,包括在本地/远程(远程仅在linux/osx平台可用)vir ...
- php 登录实例演示
<pre name="code" class="python">一.模板的使用 (重点) a.规则 模板文件夹下[TPL]/[分组文件夹/][模板主 ...
- Android 通过Dom, Sax, Pull解析网络xml数据
这篇文章不是完全原创,XML解析的部分参考了 liuhe688 的文章.文章地址:http://blog.csdn.net/liuhe688/article/details/6415593 这是一个几 ...
- PyQt写的浏览单web页面的browser - 开源中国社区
PyQt写的浏览单web页面的browser - 开源中国社区 PyQt写的浏览单web页面的browser
- rebol高速入门
看了Java夜未眠之后,我也有点想学习其它语言了,希望能够完毕Python在写GUI程序和Web的程序的缺陷,写GUI程序比較看好VB,写Web程序看好PHP,不过首先想玩玩rebol. 翻译的Reb ...
- libevent入门
Libevent API =============================== evtimer_new evtimer_new(base, callback, NULL) 用来做定时器,即当 ...
- Matlab pivotgolf
function scoreout = pivotgolf(course,pivotstrat) % PIVOTGOLF Pivot Pickin' Golf. % Your goal is to u ...
- js动态创建表格方法
window.onload = function(){ var table = document.createElement('table'); table.border = 1; table.wid ...