這是我弄糊塗的路線。這條線在android編程中意味着什麼?
InputType.TYPE_CLASS_TEXT | InputType.TYPE_NUMBER_VARIATION_PASSWORD
在這個方案
:
public class TextPlay extends Activity {
Button clickMe;
TextView txtply;
ToggleButton toggle;
EditText et1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_text_play);
clickMe= (Button)findViewById(R.id.txt_ply_Clickme);
txtply= (TextView)findViewById(R.id.txt_ply_textview);
toggle= (ToggleButton)findViewById(R.id.txt_ply_toggle);
et1=(EditText)findViewById(R.id.txt_ply_edittext);
toggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(toggle.isChecked()) {
et1.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_NUMBER_VARIATION_PASSWORD);
}
else {
et1.setInputType(InputType.TYPE_CLASS_TEXT);
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.text_play, menu);
return true;
}
}
你不明白'setInputType'文件或'|'<=「二進制或運算符」 – Selvin