设置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 ...
随机推荐
- servlet三种实现方式之一实现servlet接口
servlet有三种实现方式: 1.实现servlet接口 2.继承GenericServlet 3.通过继承HttpServlet开发servlet 第一种示例代码如下(已去掉包名): import ...
- mysql数据迁移
使用mysqldump mysqldump -host=host1 -uroot -p123456 -opt sourceDb| mysql -host=host2 -uroot -p123 -C t ...
- IOS本地化。
1,项目名本地化 点击项目,蓝色图标->info 最下面+号,添加chinese本地化. Supporting Files->infoPlist.strings 下会有两个文件,有一个是设 ...
- freebsd
#cd /usr/ports/devel/binutils && make install
- python下读取excel文件
项目中要用到这个,所以记录一下. python下读取excel文件方法多种,用的是普通的xlrd插件,因为它各种版本的excel文件都可读. 首先在https://pypi.python.org/py ...
- 用Mediawiki做百科网站资源大参考
MediaWiki简易安装教程**关于mediawiki 一些好的资料: http://codex.wordpress.org.cn/Mediawiki%E5%BB%BA%E7%AB%99%E7%BB ...
- HDU 2815 Mod Tree
不会,先搁着…… http://blog.csdn.net/acm_cxlove/article/details/7832197
- openstack之keystone
一.什么是keystone 用于为openstack家族中的其它组件成员提供统一的认证服务,包括身份认证.令牌发放和校验.服务列表.用户权限定义等: 基本概念: 用户User:用于身份认证.一个用户可 ...
- Extending your SharePoint 2007 site with Microsoft ASP.NET AJAX 3.5
After ASP.NET 3.5 has been installed you need to modify the web.config file of your MOSS web site wi ...
- No.4小白的HTML+CSS心得篇
书读百遍,其义自见 遵照这句话 今天再次重新把慕课网的HTML+CSS看了一遍,再次阅读感受不再是那么陌生,从而心里默默地喜欢上了这种方式,坚持. 好了,开始今天的收获小总结 1.html中,表单&l ...