当前位置: 首页>>代码示例>>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;未经允许,请勿转载。