设置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 ...
随机推荐
- 05-C语言运算符
目录: 一.进制转换 二.常量 三.sizeof 四.运算符 五.赋值运算符 六.自增减运算符 七.关系运算符 八.逻辑运算符 九.取址寻址运算符 回到顶部 一.进制转换 1 进制转换是人们利用符号来 ...
- oracle整体知识的大致介绍(1)-概念
表空间: oracle允许不同类型的数据分开存放,表空间是数据库的逻辑划分. 数据文件: 表空间由同一磁盘上的一个或多个文件组成,这些文件叫做数据文件. 实例: 是存放和控制数据库的软件机制. ora ...
- Intellij IDEA创建Maven Web项目
1前言 在创建项目中,IDEA提供了非常多项目模板,比方Spring MVC模板,能够直接创建一个基于Maven的Spring MVC的demo,各种配置都已经设定好了,直接编译部署就能够使用. 最開 ...
- rebol高速入门
看了Java夜未眠之后,我也有点想学习其它语言了,希望能够完毕Python在写GUI程序和Web的程序的缺陷,写GUI程序比較看好VB,写Web程序看好PHP,不过首先想玩玩rebol. 翻译的Reb ...
- uestc 250 数位dp(水)
/* 数位dp 水题 开两维一个记录长度,一个记录上一个数 */ #include<stdio.h> #include<string.h> #define N 13 int d ...
- SharePoint 2010以其他用户身份登录的弹出代码
在SharePoint 2010平台中,可以在当前用户登录系统的情况下使用其他用户身份登录,以达到在同一浏览器中切换用户身份的目的. 每个用户登录SharePoint系统之后都会在系统右上角将用户的名 ...
- eclipse主题插件
打开eclipse ,选择 Help 选择Install New Software 点击 Add 输入http://eclipse-color-theme.github.com/update,选中Ec ...
- 【转】Configuring VM Acceleration on Linux
Configuring VM Acceleration on Linux Linux-based systems support virtual machine acceleration throug ...
- char*与char[]
char *s1="hello"; // 指向常量区 char s2[]="hello"; // 指向数组的内存空间 char *s1 的s1是指针,指 ...
- JDBC_获取数据库连接
<span style="font-size:24px;">package src.com.jdbc.java; import java.io.IOException; ...