zoukankan      html  css  js  c++  java
  • demo05

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
    
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
    
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:paddingBottom="@dimen/activity_vertical_margin"
        tools:context=".MainActivity">
    
        <TextView
            android:id="@+id/msg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="please input userpassword:"
            />
         <EditText
             android:id="@+id/password"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             />
        <CheckBox
            android:id="@+id/show"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:text="show Password"
            />
    
         <TextView
             android:id="@+id/xinbei"
             android:text="你的性别是:"
             android:layout_width="fill_parent"
             android:layout_height="wrap_content"
             android:textSize="20px"/>
    
    
    
    </LinearLayout>
    ===========================
    
    
    package com.example.chapter06passwordrediogroup;
    
    import android.os.Bundle;
    import android.app.Activity;
    import android.text.method.HideReturnsTransformationMethod;
    import android.text.method.PasswordTransformationMethod;
    import android.view.Menu;
    import android.view.View;
    import android.widget.CheckBox;
    import android.widget.EditText;
    
    public class MainActivity extends Activity {
    
        private EditText password=null;
        private CheckBox show =null;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
           this.password= (EditText)super.findViewById(R.id.password);
           this.show = (CheckBox)super.findViewById(R.id.show);
           this.show.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View view) {
                   if (show.isChecked()){
                       MainActivity.this.password.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
                   }else{
                       MainActivity.this.password.setTransformationMethod(PasswordTransformationMethod.getInstance());
                   }
               }
           });
    
        }
    
    
        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.main, menu);
            return true;
        }
        
    }
  • 相关阅读:
    点击复制的代码
    色彩浅谈——同色系的变化
    网页设计中色彩的运用
    网页设计中透明效果的使用技巧
    基于栅格的网站设计
    页面之门——登录页的设计分析
    错误变惊喜,10个有趣的404页面设计(转)
    jQuery load()方法用法集锦!
    RPM命令用法
    如何使iframe透明
  • 原文地址:https://www.cnblogs.com/alamps/p/5240336.html
Copyright © 2011-2022 走看看