密码效果以及跑马灯效果:

 

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的密码效果以及跑马灯效果的更多相关文章

  1. Android开发:文本控件详解——TextView(二)文字跑马灯效果实现

    一.需要使用的属性: 1.android:ellipsize 作用:若文字过长,控制该控件如何显示. 对于同样的文字“Android开发:文本控件详解——TextView(二)文字跑马灯效果实现”,不 ...

  2. TextView标签的属性和跑马灯效果

    text:显示的内容 textSize:文本的大小 textColor:文本的颜色 visibility:可见性  默认可见,invisible:表示不可见,但对控件的显示区域做了保留 gone:隐藏 ...

  3. Textview在Listview中实现跑马灯效果

    textview添加属性:   android:singleLine="true" 表示单行显示   android:ellipsize="marquee" 设 ...

  4. android 怎么实现跑马灯效果

    自定义控件 FocusedTextView, 使android系统误以为它拥有焦点 public class FocusedTextView extends TextView { public Foc ...

  5. android实现跑马灯效果(能够实现两个以上跑马灯)

    本文用了继承自TextView的MarqueeTextView来实现跑马灯效果.原因是,跑马灯效果是须要TextView拥有焦点才会跑动的.而有时候TextView获得焦点会有点耗时,造成要等待一段时 ...

  6. iOS中跑马灯效果小结

    时光过得好快,记忆中刚刚从春节返回没有多久,清明.五一已飞逝而过,眨眼已到盛夏季节.不过还好,济南这两年不算太热,刚开始升温几天,一场及时雨总能让温度保持适宜.为了纪念一下青春的尾巴,也为了能有个健康 ...

  7. TextView跑马灯效果

    转载:http://www.2cto.com/kf/201409/330658.html 一.只想让TextView显示一行,但是文字超过TextView的长度怎么办?在开头显示省略号 android ...

  8. [Android1.5]TextView跑马灯效果

    from: http://www.cnblogs.com/over140/archive/2010/08/20/1804770.html 前言 这个效果在两周前搜索过,网上倒是有转载,可恨的是转载之后 ...

  9. 【Android】TextView跑马灯效果

    老规矩,先上图看效果. 说明 TextView的跑马灯效果也就是指当你只想让TextView单行显示,可是文本内容却又超过一行时,自动从左往右慢慢滑动显示的效果就叫跑马灯效果. 其实,TextView ...

随机推荐

  1. Redis的入门Demo(java)

    java代码部分参考了:http://www.runoob.com/redis/redis-java.html 在java中使用Redis,需要引入Redis驱动,就是jedis-2.1.0.jar, ...

  2. MySQL FEDERATED 存储引擎

    MySQL中针对不同的功能需求提供了不同的存储引擎.所谓的存储引擎也就是MySQL下特定接口的具体实现. FEDERATED是其中一个专门针对远程数据库的实现.一般情况下在本地数据库中建表会在数据库目 ...

  3. PHP glob() 函数用法

    glob() 函数返回匹配指定模式的文件名或目录. 该函数返回一个包含有匹配文件 / 目录的数组.如果出错返回 false. 语法 array glob ( string $pattern [, in ...

  4. HDU 1584 蜘蛛牌

    题解:纸牌只能移到比其大一的纸牌上,所以移动方向是定的,那么,就只有选择移动先后的问题了,对于决定要移的纸牌,比如1,如果2,3,4都是visited的状态,那么1一定是要移动到5的,因为2,3,4一 ...

  5. nginx-lua实现简单权限控制

    1,依赖软件:nginx(openresty) mysql(存储用户表)redis(存储用户登录token,有效期1周) create table account( uid integer not n ...

  6. nopcommerce插件使用

    nopcommerce是国外用.net开发的电商b2c开源项目,主要涉及技术包括了ef+mvc. 今天主要分析nop的插件机制. 什么是插件?插件是预先开发好的可以独立运行的功能模块,把单独的功能模块 ...

  7. C# MyNewQueue 消息队列

    C# using System; using System.Messaging; using System.Drawing; using System.IO; namespace MyProject ...

  8. 基于RSA securID的Radius二次验证java实现(PAP验证方式)

    基于rsa SecurID的二次验证.RSA server自身可以作为Radius服务器,RSA也可以和其他的软件集合,使用其他的server作为Radius服务器. radius的验证的一般流程如下 ...

  9. Nginx 之三:nginx服务器模块、web请求处理机制及事件驱动模型、进程功能和进程间通信

    一:Nginx的模块化结构设计: 1.核心模块:指的是nginx服务器运行当中必不可少的模块,这些模块提供了最基本最核心的服务,比如权限控制.进程管理.错误日志.事件驱动.正则表达式解析等,nginx ...

  10. [LeetCode]题解(python):063-Unique Paths II

    题目来源: https://leetcode.com/problems/unique-paths-ii/ 题意分析: 这题的规则和上一题一样.给一个m×n的矩阵0,1矩阵.0代表可以经过,1代表不可以 ...