最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android實(shí)現(xiàn)動(dòng)態(tài)顯示或隱藏密碼輸入框的內(nèi)容

 更新時(shí)間:2014年09月04日 11:35:01   投稿:shichen2014  
這篇文章主要介紹了Android實(shí)現(xiàn)動(dòng)態(tài)顯示或隱藏密碼輸入框的內(nèi)容,主要通過設(shè)置EditText的setTransformationMethod()方法來實(shí)現(xiàn),需要的朋友可以參考下

本文實(shí)例展示了Android實(shí)現(xiàn)動(dòng)態(tài)顯示或隱藏密碼輸入框內(nèi)容的方法,分享給大家供大家參考之用。具體方法如下:

該功能可通過設(shè)置EditText的setTransformationMethod()方法來實(shí)現(xiàn)隱藏密碼或者顯示密碼。

示例代碼如下:

private Button mBtnPassword;
private EditText mEtPassword;
private boolean mbDisplayFlg = false;
 
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  mEtPassword = (EditText)findViewById(R.id.password);
  mBtnPassword = (Button)findViewById(R.id.btnPassword);
  mBtnPassword.setOnClickListener(new OnClickListener() {

 @Override
 public void onClick(View v) {
 // TODO Auto-generated method stub
 Log.d("AndroidTest", "mbDisplayFlg = " + mbDisplayFlg);
 if (!mbDisplayFlg) {
  // display password text, for example "123456"
  mEtPassword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
 } else {
  // hide password, display "."
  mEtPassword.setTransformationMethod(PasswordTransformationMethod.getInstance());
 }
 mbDisplayFlg = !mbDisplayFlg;
 mEtPassword.postInvalidate();
 }
  });
}

main.xml文件如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical" android:layout_width="fill_parent"
 android:layout_height="fill_parent">
 <Button android:id="@+id/btnPassword"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="密碼" />
 <EditText android:id="@+id/password"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:password="true"
 android:textSize="18sp"
 android:text="123456">
 </EditText>
</LinearLayout>

希望本文所述對(duì)大家的Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • Android動(dòng)態(tài)使用VectorDrawable過程詳解

    Android動(dòng)態(tài)使用VectorDrawable過程詳解

    這篇文章主要介紹了Android動(dòng)態(tài)使用VectorDrawable過程,2014年6月26日的I/O 2014開發(fā)者大會(huì)上谷歌正式推出了Android L,它帶來了全新的設(shè)計(jì)語言Material Design,新的API也提供了這個(gè)類VectorDrawable
    2023-02-02
  • Android編程實(shí)現(xiàn)帶漸變效果的圓角矩形示例

    Android編程實(shí)現(xiàn)帶漸變效果的圓角矩形示例

    這篇文章主要介紹了Android編程實(shí)現(xiàn)帶漸變效果的圓角矩形,涉及Android界面布局及屬性設(shè)置相關(guān)操作技巧,需要的朋友可以參考下
    2017-08-08
  • Android ApplicationContext接口深入分析

    Android ApplicationContext接口深入分析

    ApplicationContext是Spring應(yīng)用程序中的中央接口,由于繼承了多個(gè)組件,使得ApplicationContext擁有了許多Spring的核心功能,如獲取bean組件,注冊(cè)監(jiān)聽事件,加載資源文件等
    2022-11-11
  • Android實(shí)現(xiàn)頂部弧形背景效果

    Android實(shí)現(xiàn)頂部弧形背景效果

    在當(dāng)今移動(dòng)互聯(lián)網(wǎng)應(yīng)用中,界面設(shè)計(jì)的美觀與交互體驗(yàn)往往成為用戶評(píng)價(jià)一款產(chǎn)品的重要因素之一,本文將詳細(xì)介紹如何在 Android 應(yīng)用中實(shí)現(xiàn)頂部弧形背景效果,通過自定義 View、繪制原理和動(dòng)畫特效等多種技術(shù)手段,打造出既美觀又具有較好擴(kuò)展性的界面背景效果
    2025-04-04
  • Android對(duì)EditTex的圖片實(shí)現(xiàn)監(jiān)聽

    Android對(duì)EditTex的圖片實(shí)現(xiàn)監(jiān)聽

    這篇文章主要為大家詳細(xì)介紹了Android如何對(duì)EditTex的圖片實(shí)現(xiàn)監(jiān)聽,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-10-10
  • 配置一個(gè)好用的Android模擬器讓你不再對(duì)模擬器那么失望

    配置一個(gè)好用的Android模擬器讓你不再對(duì)模擬器那么失望

    默認(rèn)情況下的Android模擬器窗口占據(jù)了屏幕巨大的空間,而且毫無緣由的放著一個(gè)屏幕鍵盤,如果你沒親自用過模擬器的話,還有一個(gè)不易發(fā)現(xiàn)的問題:幾乎是慢到不能用
    2013-01-01
  • Android實(shí)現(xiàn)單選與多選對(duì)話框的代碼

    Android實(shí)現(xiàn)單選與多選對(duì)話框的代碼

    這篇文章主要介紹了Android實(shí)現(xiàn)單選與多選對(duì)話框的代碼,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-01-01
  • Android開發(fā)Compose框架使用開篇

    Android開發(fā)Compose框架使用開篇

    這篇文章主要為大家介紹了Android開發(fā)Compose框架使用開篇,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-09-09
  • Android實(shí)現(xiàn)自定義的衛(wèi)星式菜單(弧形菜單)詳解

    Android實(shí)現(xiàn)自定義的衛(wèi)星式菜單(弧形菜單)詳解

    相信大家經(jīng)常在應(yīng)用中會(huì)看到衛(wèi)星菜單,那么這篇文章就來介紹在Android中如何實(shí)現(xiàn)自定義的衛(wèi)星式菜單(弧形菜單),有需要的可以參考學(xué)習(xí)。
    2016-08-08
  • Android實(shí)現(xiàn)圖片設(shè)置圓角形式

    Android實(shí)現(xiàn)圖片設(shè)置圓角形式

    這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)圖片設(shè)置圓角形式,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-11-11

最新評(píng)論

宝坻区| 青海省| 紫阳县| 汕头市| 江源县| 许昌市| 昆明市| 临武县| 大理市| 比如县| 江城| 遂宁市| 静乐县| 舟山市| 通江县| 莱阳市| 邵阳市| 丰城市| 泰顺县| 平阳县| 澜沧| 延长县| 昔阳县| 灵宝市| 海门市| 利津县| 通辽市| 荥阳市| 永登县| 溆浦县| 都江堰市| 海盐县| 新化县| 榆林市| 赞皇县| 马鞍山市| 宝坻区| 将乐县| 翁源县| 沙坪坝区| 靖宇县|