當前位置: 首頁>>代碼示例>>Java>>正文


Java EditText.setKeyListener方法代碼示例

本文整理匯總了Java中android.widget.EditText.setKeyListener方法的典型用法代碼示例。如果您正苦於以下問題:Java EditText.setKeyListener方法的具體用法?Java EditText.setKeyListener怎麽用?Java EditText.setKeyListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.EditText的用法示例。


在下文中一共展示了EditText.setKeyListener方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreate

import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate( Bundle savedInstanceState )
{
	super.onCreate( savedInstanceState );
	penClient = PenClientCtrl.getInstance( getApplicationContext() );
	if(penClient.getProtocolVersion() == 1)
		addPreferencesFromResource( R.xml.pref_settings );
	else
		addPreferencesFromResource( R.xml.pref_settings2 );



	mPasswordPref = (EditTextPreference) getPreferenceScreen().findPreference( Const.Setting.KEY_PASSWORD );

	EditText myEditText = (EditText) mPasswordPref.getEditText();
	myEditText.setKeyListener( DigitsKeyListener.getInstance( false, true ) );
}
 
開發者ID:NeoSmartpen,項目名稱:AndroidSDK2.0,代碼行數:18,代碼來源:SettingActivity.java

示例2: setEditTextDisabled

import android.widget.EditText; //導入方法依賴的package包/類
private static void setEditTextDisabled(EditText editText) {
    editText.setInputType(InputType.TYPE_NULL);
    editText.setTextIsSelectable(true);
    editText.setKeyListener(null);

    editText.setBackgroundResource(R.drawable.edit_text_readonly);
    int color = StyledAttributesHelper.getColor(editText.getContext(), android.R.attr.textColorSecondary, 0);
    ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(color));
    ((ViewGroup) editText.getParent()).setAddStatesFromChildren(false);
}
 
開發者ID:MCMrARM,項目名稱:revolution-irc,代碼行數:11,代碼來源:EditCommandAliasActivity.java

示例3: initViews

import android.widget.EditText; //導入方法依賴的package包/類
private void initViews() {
	etPwd = (EditText)findViewById(R.id.pwd);
	etInfo = (EditText)findViewById(R.id.info);
	tvTip = (TextView)findViewById(R.id.tip);
	tvErrorMsg = (TextView)findViewById(R.id.errorMsg);
	btnOperate = (Button)findViewById(R.id.ok);
	btnOperate.setOnClickListener(this);
	
	//取得從上一個Activity傳遞過來的數據
	bundle = this.getIntent().getExtras();
	actBar.setTitle(bundle.getString(BAR_TITLE));
	etInfo.setText(bundle.getString(INFO));
	if (bundle.getBoolean(INFO_READONLY)){
		etInfo.setKeyListener(null);
	}else{
		etInfo.setSelection(etInfo.getText().length());
	}
	strRegex = bundle.getString(REGEX);
	tvTip.setText(bundle.getString(TIP));
	btnOperate.setText(bundle.getString(OPERATE_TEXT));
	
	//設置隱藏項
	String strOperate = bundle.getString(OPERATE);
	if (strOperate.equals(OPERATE_BIND_EMAIL) || strOperate.equals(OPERATE_BIND_PHONE)){
		etPwd.setVisibility(View.VISIBLE);
	}else{
		etPwd.setVisibility(View.GONE);
	}
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:30,代碼來源:EditTextAty.java

示例4: ViewHolder

import android.widget.EditText; //導入方法依賴的package包/類
public ViewHolder(View itemView) {
    super(itemView);

    inputEmail = (EditText) itemView.findViewById(R.id.input_email);
    inputEmail.setKeyListener(null);
    checkBox = (CheckBox) itemView.findViewById(R.id.checkbox);
    editButton = (ImageButton) itemView.findViewById(R.id.edit);
    checkBox.setChecked(false);
}
 
開發者ID:othreecodes,項目名稱:Quicksend,代碼行數:10,代碼來源:CompanyAdapter.java

示例5: onCreate

import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_text_editor);
    MainUtils.closeActionBarButton(this);
    if (getSupportActionBar()!=null) {
        getSupportActionBar().setTitle("Editor");
    }
    mEditText=(EditText) findViewById(R.id.editor_area);
    mProgressDialog =new ProgressDialog(this);
    mlength=mEditText.getText().length();
    mkeylistener=mEditText.getKeyListener();
    mEditText.setKeyListener(null);
    mEditText.setEnabled(false);
    String path=getIntent().getExtras().getString(CommonConstants.TEXTEDITACT_PARAM_PATH);
    if(path!=null){
        mFile=new File(path);
        if(mFile.isDirectory()){
          isNewFile=true;
            mPath=mFile.getAbsolutePath();
        }else{
            mPath=path;
            Log.d(TAG, "onCreate: file path is: "+path);
            new FileOpenTask().execute();
        }
    }

}
 
開發者ID:mosamabinomar,項目名稱:RootPGPExplorer,代碼行數:29,代碼來源:TextEditorActivity.java

示例6: setCardInput

import android.widget.EditText; //導入方法依賴的package包/類
public void setCardInput(Context context){
    EditText input=  ((EditText) findViewById(R.id.inputEdit));
    input.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
    input.setKeyListener(DigitsKeyListener.getInstance(context.getResources().getString(R.string.filter_vcode)));
}
 
開發者ID:fengdongfei,項目名稱:CXJPadProject,代碼行數:6,代碼來源:OneInputDialog.java

示例7: onCreate

import android.widget.EditText; //導入方法依賴的package包/類
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.edit_activity);

        String pathFile = getIntent().getStringExtra(Commons.pathFile);

        TextView tv = (TextView) findViewById(R.id.notetitle);
        tv.setTextColor(Color.WHITE);
        tv.setText(""+pathFile);

        //Get the text file
        File file = new File(pathFile);

        //Read text from file
        StringBuilder text = new StringBuilder();

        try {
            BufferedReader br = new BufferedReader(new FileReader(file));
            String line;

            while ((line = br.readLine()) != null) {
                text.append(line);
                text.append('\n');
            }
            br.close();
        }
        catch (IOException e) {
            //You'll need to add proper error handling here
        }

//Find the view by its id
        EditText edit = (EditText) findViewById(R.id.note);

//Set the text
        edit.setFocusable(false);
        edit.setFocusableInTouchMode(false);
        edit.clearFocus();
        edit.setTag(edit.getKeyListener());
        edit.setKeyListener(null);
        edit.setText(text.toString());
        edit.setTextColor(Color.DKGRAY);
    }
 
開發者ID:lmartire,項目名稱:DoApp,代碼行數:44,代碼來源:ViewReportActivity.java

示例8: onCreate

import android.widget.EditText; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pay_bill);
    View decorView = getWindow().getDecorView();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        Window window = getWindow();
        // Translucent status bar
        window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager
                .LayoutParams.FLAG_TRANSLUCENT_STATUS);
    }
    Intent intent = getIntent();
    final Bundle bundle = intent.getExtras();

    vertifyView=(TextView)findViewById(R.id.timer);
    final TextView money = (TextView)findViewById(R.id.textView3);
    TextView name=(TextView)findViewById(R.id.textView4);
    TextView phone = (TextView)findViewById(R.id.textView7);
    TextView packSort= (TextView)findViewById(R.id.textView8);
    TextView pickNum = (TextView)findViewById(R.id.textView9);
    Button pickPlace=(Button)findViewById(R.id.button);
    Button delieverPlace = (Button)findViewById(R.id.button2);
    TextView pickTime =(TextView)findViewById(R.id.pick_time);
    TextView delieverTime=(TextView)findViewById(R.id.deliever_time);
    Button ensureBillBtn = (Button)findViewById(R.id.ensure_bill_btn);

    Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
    toolbar.setTitle("確認支付");
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if(actionBar != null){
        actionBar.setDisplayHomeAsUpEnabled(true);
    }


    timer.start();
    EditText total = (EditText)findViewById(R.id.textView3);

    total.setKeyListener(null);

    String fetchTime = bundle.getString("pickuptime");
    int index1 = fetchTime.indexOf('日');
    fetchTime = "\t\t\t\t"+fetchTime.substring(0,index1+1)+" "+fetchTime.substring(index1+2);
    String sendTime = bundle.getString("delievertime");
    int index2 = sendTime.indexOf('日');
    sendTime = "\t\t\t\t"+sendTime.substring(0,index2+1)+" "+sendTime.substring(index2+2);

    if(bundle!=null){
        money.setText("¥ "+bundle.getString("money"));
        name.setText(bundle.getString("name"));
        phone.setText(bundle.getString("phone"));
        packSort.setText(bundle.getString("packsort"));
        pickNum.setText(bundle.getString("num"));
        pickPlace.setText(bundle.getString("pickupplace"));
        delieverPlace.setText(bundle.getString("delieverplace"));
        pickTime.setText(fetchTime);
        delieverTime.setText(sendTime);
        ensureBillBtn.setText("確認支付 ¥ "+bundle.getString("money"));
    }


    mPostInfoFormView = findViewById(R.id.pay_form);
    mProgressView = findViewById(R.id.pay_progress);

    ensureBillBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            SharedPreferences sp = getSharedPreferences("now_account", Context.MODE_PRIVATE);
            String stuNum = sp.getString("now_stu_num", null);
            FetchUserInfo fetchUserInfo = new FetchUserInfo(stuNum);
            fetchUserInfo.execute();

        }
    });
}
 
開發者ID:Luodian,項目名稱:Shared-Route,代碼行數:81,代碼來源:PayBillActivity.java


注:本文中的android.widget.EditText.setKeyListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。