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


Java TextView.requestFocus方法代碼示例

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


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

示例1: onResume

import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onResume()
{
    super.onResume();
    final Activity activity = getActivity();
    final boolean tcAccepted = ConfigHelper.isTCAccepted(activity);
    if (tcAccepted)
    {
        final TextView buttonTermsAccept = (TextView) view.findViewById(R.id.termsAcceptButton);
        buttonTermsAccept.setFocusable(true); //set focus on button so that terms can be accepted on Android TV like devices (5-way-navigation)
        buttonTermsAccept.setFocusableInTouchMode(false);
        buttonTermsAccept.requestFocus();
        buttonTermsAccept.setText(R.string.terms_accept_button_continue);
        view.findViewById(R.id.termsAcceptText).setVisibility(View.GONE);
    }
}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:17,代碼來源:RMBTTermsCheckFragment.java

示例2: initView

import android.widget.TextView; //導入方法依賴的package包/類
private void initView() {
    mTargetPortrait = (AsyncImageView) findViewById(R.id.target_portrait);
    mTargetName = (TextView) findViewById(R.id.target_name);
    mArrow = (ImageView) findViewById(R.id.target_group_arrow);
    mContactName = (TextView) findViewById(R.id.contact_name);
    mMessage = (EditText) findViewById(R.id.message);
    mSend = (TextView) findViewById(R.id.send);
    mCancel = (TextView) findViewById(R.id.cancel);
    mViewAnimator = (ViewAnimator) findViewById(R.id.va_detail);
    mGridView = (GridView) findViewById(R.id.gridview);

    mCancel.requestFocus();
    this.setFinishOnTouchOutside(false);
}
 
開發者ID:hushengjun,項目名稱:FastAndroid,代碼行數:15,代碼來源:ContactDetailActivity.java

示例3: onClick

import android.widget.TextView; //導入方法依賴的package包/類
public void onClick(View v) {
	
	
	v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
	
	switch (v.getId()) {
		case R.id.fragment_forgot_password_submit:
			
		boolean validForm = true;
		TextView forgotEmail = (TextView) getActivity().findViewById(R.id.fragment_forgot_password_email_address);
		
		if (forgotEmail .getText().length() == 0) {
			forgotEmail.setError("Please enter your e-mail address.");
			forgotEmail.requestFocus();
			validForm  = false;
		} else if (!android.util.Patterns.EMAIL_ADDRESS.matcher(forgotEmail.getText()).matches()) {
			forgotEmail.setError("Please enter valid e-mail address.");
			forgotEmail.requestFocus();
			validForm = false;
		}
		
		
		if (validForm) {
			InputMethodManager inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
			inputManager.hideSoftInputFromWindow(forgotEmail.getWindowToken(), 0);

			mResetPassTask = new ResetPasswordTask().execute(new String[]{forgotEmail.getText().toString()});
		}
			
			
		break;

	}
	
}
 
開發者ID:Greenstand,項目名稱:treetracker-android,代碼行數:36,代碼來源:ForgotPasswordFragment.java


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