本文整理汇总了C#中EditText.RequestFocus方法的典型用法代码示例。如果您正苦于以下问题:C# EditText.RequestFocus方法的具体用法?C# EditText.RequestFocus怎么用?C# EditText.RequestFocus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditText
的用法示例。
在下文中一共展示了EditText.RequestFocus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Android.OS.Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.xy_chart);
mValue = FindViewById<EditText>(Resource.Id.xValue);
mRenderer.ZoomButtonsVisible = true;
mRenderer.StartAngle = 180;
mRenderer.DisplayValues = true;
mAdd = FindViewById<Button>(Resource.Id.add);
mAdd.Enabled = true;
mValue.Enabled = true;
mAdd.Click += (e, s) =>
{
double value = 0;
try
{
value = Double.Parse(mValue.Text);
}
catch (Java.Lang.NumberFormatException)
{
mValue.RequestFocus();
return;
}
mValue.Text = "";
mValue.RequestFocus();
mSeries.Add("Series " + (mSeries.ItemCount + 1), value);
SimpleSeriesRenderer renderer = new SimpleSeriesRenderer();
renderer.Color = COLORS[(mSeries.ItemCount - 1) % COLORS.Length];
mRenderer.AddSeriesRenderer(renderer);
mChartView.Repaint();
};
}
示例2: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
if (!((GlobalvarsApp)this.Application).ISLOGON) {
Finish ();
}
SetTitle (Resource.String.title_payment);
SetContentView (Resource.Layout.Payment);
string samt = Intent.GetStringExtra ("amount") ?? "0";
amount = Convert.ToDouble (samt);
txtAmt = FindViewById<EditText> (Resource.Id.payamt);
txtRound = FindViewById<EditText> (Resource.Id.payround);
txtTotal = FindViewById<EditText> (Resource.Id.paytotal);
txtCash = FindViewById<EditText> (Resource.Id.paycash);
txtChange = FindViewById<EditText> (Resource.Id.paychange);
txtAmt.Text = amount.ToString ("n2");
double roundVal=0;
double ttlAmt = Utility.AdjustToNear (amount, ref roundVal);
txtRound.Text = roundVal.ToString ("n2");
txtTotal.Text = ttlAmt.ToString ("n2");
txtCash.EditorAction += HandleEditorAction;
txtCash.AfterTextChanged += TxtCash_AfterTextChanged;
Button butInvBack= FindViewById<Button> (Resource.Id.payok);
butInvBack.Click += (object sender, EventArgs e) => {
base.OnBackPressed ();
};
txtCash.RequestFocus ();
}
示例3: OnCreate
protected override async void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Login);
GlobalServices.XjtuSite.Account.IsLoggedInChanged += Account_IsLoggedInChanged;
if (!await UpdateAccountStatus())
{
userNameView = FindViewById<EditText>(Resource.Id.accountNameEdit);
passwordView = FindViewById<EditText>(Resource.Id.passwordEdit);
savePasswordCheckBox = FindViewById<CheckBox>(Resource.Id.savePasswordCheckbox);
loginButton = FindViewById<Button>(Resource.Id.loginButton);
//ÔØÈëÉèÖá£
using (var pref = GetPreferences(FileCreationMode.Private))
{
userNameView.Text = pref.GetString("userName", "");
passwordView.Text = pref.GetString("password", "");
savePasswordCheckBox.Checked = pref.GetBoolean("savePassword", false);
}
if (!string.IsNullOrWhiteSpace(userNameView.Text)) passwordView.RequestFocus();
//ÕìÌýʼþ¡£
EventHandler<TextChangedEventArgs> userNamePasswordChanged = (_, e) =>
{
loginButton.Enabled = !string.IsNullOrWhiteSpace(userNameView.Text) &&
!string.IsNullOrEmpty(passwordView.Text);
};
userNameView.TextChanged += userNamePasswordChanged;
passwordView.TextChanged += userNamePasswordChanged;
savePasswordCheckBox.CheckedChange += SavePasswordCheckBox_CheckedChange;
loginButton.Click += LoginButton_Click;
}
}
示例4: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView (inflater, container, savedInstanceState);
var view = inflater.Inflate (Resource.Layout.QuoteLayout, container, false);
quoteLocation = view.FindViewById<EditText> (Resource.Id.quoteLocation);
quoteModel = view.FindViewById<EditText> (Resource.Id.quoteModel);
quotePrice = view.FindViewById<EditText> (Resource.Id.quotePrice);
quotePosition = view.FindViewById<EditText> (Resource.Id.quotePosition);
quoteButton = view.FindViewById<Button> (Resource.Id.quoteButton);
quoteLocation.Text = location;
quoteModel.Text = model;
quotePrice.RequestFocus ();
quoteButton.Click += delegate {
double price;
bool isDouble = Double.TryParse(quotePrice.Text, out price);
if(isDouble) {
if (price > minPrice) {
if (price < minPrice * 1.6) {
position = quotePosition.Text;
if (position.Length < 15) {
Thread thread = new Thread(() => { Database.quote(location, model, quotePrice.Text, position); });
thread.Start();
}
else {
Thread thread = new Thread(() => { Database.quote(location, model, quotePrice.Text, ""); });
thread.Start();
}
}
quotePrice.SetBackgroundColor(Android.Graphics.Color.Lime);
Toast.MakeText(Application.Context, "成功報價!更新中...", ToastLength.Short).Show();
var activity = (MainActivity)Activity;
Thread thread2 = new Thread(() => { activity.FragmentManager.PopBackStack(); Thread.Sleep(1000); activity.updateGUI(Database.select(location));
activity.RunOnUiThread(() => {
Toast.MakeText(Application.Context, "更新成功!", ToastLength.Short).Show();
});
});
thread2.Start();
}
else { quotePrice.SetBackgroundColor(Android.Graphics.Color.Red); quotePrice.Error = "有幾多我同你買幾多!"; }
}
else { quotePrice.SetBackgroundColor(Android.Graphics.Color.Red); quotePrice.Error = "Enter number!"; }
};
return view;
}
示例5: SetViews
private void SetViews()
{
_email = Activity.FindViewById<EditText>(Resource.Id.email);
_email.RequestFocus();
_confirmEmail = Activity.FindViewById<EditText>(Resource.Id.confirmEmail);
_userName = Activity.FindViewById<EditText>(Resource.Id.userName);
_password = Activity.FindViewById<EditText>(Resource.Id.password);
_confirmPassword = Activity.FindViewById<EditText>(Resource.Id.confirmPassword);
_submit = Activity.FindViewById<Button>(Resource.Id.submit);
}
示例6: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
try
{
_view = inflater.Inflate(Resource.Layout.InputDialog, container);
_editTextCvvValue = (EditText)_view.FindViewById(Resource.Id.editTextCvvValue);
_textViewMessage = (TextView)_view.FindViewById(Resource.Id.textViewMessage);
_buttonOk = _view.FindViewById<Button>(Resource.Id.buttonOk);
_buttonOk.Click += ButtonOkClick;
string title = this.Arguments.GetString("title", "PI");
string message = this.Arguments.GetString("message", "Input the value");
this.Dialog.SetTitle(title);
_textViewMessage.Text = message;
_editTextCvvValue.RequestFocus();
this.Dialog.Window.SetSoftInputMode(SoftInput.StateVisible);
}
catch (Exception ex)
{
Helpers.Alert(_context, "PI - CvvInputFragment - OnCreateView", ex.Message, false);
}
return _view;
}
示例7: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView(Resource.Layout.main);
_itemListView = FindViewById<ListView>(Resource.Id.itemListView);
_itemListView.OnItemClickListener = this;
_itemListView.OnItemLongClickListener = this;
_addItemEditText = FindViewById<EditText>(Resource.Id.newItemText);
_addItemEditText.SetOnKeyListener(this);
_addItemEditText.RequestFocus();
InitItemListAdapter();
_taskMgr.TasksUpdated += (sender, e) => {
_listAdapter.Clear();
_listAdapter.AddAll((ICollection)e);
_listAdapter.NotifyDataSetChanged();
};
//Step 11A - Start sync
}
示例8: Binding_TwoWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated
public void Binding_TwoWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated()
{
var control1 = new EditText(Application.Context);
var control2 = new CheckBox(Application.Context);
var binding = new Binding<string, bool>(
control1,
() => control1.Text,
control2,
() => control2.Checked,
BindingMode.TwoWay)
.ObserveSourceEvent(UpdateTriggerMode.LostFocus)
.ObserveTargetEvent(); // LostFocus doesn't work programatically with CheckBoxes
Assert.AreEqual(string.Empty, control1.Text);
Assert.IsFalse(control2.Checked);
var value = "True";
control1.RequestFocus();
control1.Text = value;
Assert.AreEqual(value, control1.Text);
Assert.IsFalse(control2.Checked);
control1.ClearFocus();
Assert.IsTrue(control2.Checked);
control2.Checked = false;
Assert.IsFalse(control2.Checked);
Assert.AreEqual("False", control1.Text);
}
示例9: Binding_OneWayFromEditTextToViewModelWithObserveEvent_BindingGetsUpdated
public void Binding_OneWayFromEditTextToViewModelWithObserveEvent_BindingGetsUpdated()
{
var vm = new TestViewModel
{
Model = new TestModel()
};
var control1 = new EditText(Application.Context);
var binding = new Binding<string, string>(
control1,
() => control1.Text,
vm,
() => vm.Model.MyProperty)
.ObserveSourceEvent(UpdateTriggerMode.LostFocus);
Assert.AreEqual(string.Empty, control1.Text);
Assert.AreEqual(string.Empty, vm.Model.MyProperty);
var value = DateTime.Now.Ticks.ToString();
control1.RequestFocus();
control1.Text = value;
Assert.AreEqual(value, control1.Text);
Assert.AreEqual(string.Empty, vm.Model.MyProperty);
control1.ClearFocus();
Assert.AreEqual(control1.Text, vm.Model.MyProperty);
}
示例10: Txtbarcode_AfterTextChanged
void Txtbarcode_AfterTextChanged(EditText txtbarcode)
{
//EditText txtbarcode = FindViewById<EditText> (Resource.Id.txtbarcode);
if (string.IsNullOrEmpty (txtbarcode.Text)) {
txtbarcode.RequestFocus ();
return;
}
var found= items.Where(x=>x.Barcode == txtbarcode.Text).ToList();
if (found.Count == 0) {
txtbarcode.Text = "";
return;
}
var item = found [0];
AddBarCodeItem (item);
RefreshItemList ();
txtbarcode.Text = "";
txtbarcode.RequestFocus ();
}
示例11: Binding_OneWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated
public void Binding_OneWayFromEditTextToCheckBoxWithObserveEvent_BindingGetsUpdated()
{
var control1 = new EditText(Application.Context);
var control2 = new CheckBox(Application.Context);
var binding = new Binding<string, bool>(
control1,
() => control1.Text,
control2,
() => control2.Checked)
.ObserveSourceEvent(UpdateTriggerMode.LostFocus);
Assert.AreEqual(string.Empty, control1.Text);
Assert.IsFalse(control2.Checked);
var value = "True";
control1.RequestFocus();
control1.Text = value;
Assert.AreEqual(value, control1.Text);
Assert.IsFalse(control2.Checked);
control1.ClearFocus();
Assert.IsTrue(control2.Checked);
}
示例12: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.LoginActivitys);
ColorDrawable colorDrawable = new ColorDrawable (Color.ParseColor (Helpers.ColorHeader));
ActionBar.SetBackgroundDrawable (colorDrawable);
BtnFacebook = FindViewById<Button> (Resource.Id.BtnFacebook);
BtnRegister = FindViewById<Button> (Resource.Id.BtnRegister);
BtnLogin = FindViewById<Button> (Resource.Id.BtnLogin);
TxtLogin = FindViewById<EditText> (Resource.Id.TxtLogin);
TxtPwd = FindViewById<EditText> (Resource.Id.TxtPwd);
BtnFacebook.Visibility = ViewStates.Gone;
#if DEBUG
TxtLogin.Text="[email protected]";
TxtPwd.Text="123456";
#endif
BtnRegister.Click += (sender, e) => {
var datosActivity = new Intent (this, typeof(RegisterActivity));
StartActivity (datosActivity);
};
BtnFacebook.Click += (sender, e) => {
var webAuth = new Intent (this, typeof(FBWebViewAuthActivity));
webAuth.PutExtra ("AppId", AppId);
webAuth.PutExtra ("ExtendedPermissions", ExtendedPermissions);
StartActivityForResult (webAuth, 0);
};
BtnLogin.Click += async (sender, e) => {
if (TxtLogin.Text == string.Empty) {
TxtLogin.SetError ("Digite su Email", null);
TxtLogin.RequestFocus ();
return;
}
if (TxtPwd.Text == string.Empty) {
TxtPwd.SetError ("Digite su Contraseña", null);
TxtPwd.RequestFocus ();
return;
}
_ProgressDialog = ProgressDialog.Show (this, "Por favor espera...", "Procesando info...", true);
ResultMsg<Users> user= await _Bussines.Login (TxtLogin.Text, TxtPwd.Text);
_ProgressDialog.Dismiss();
if(user!=null && user.Dato!=null){
this.SetUserDatos(user.Dato);
var datosActivity = new Intent (this, typeof(GridActivity));
StartActivity (datosActivity);
Finish();
}else{
Toast.MakeText (ApplicationContext, "Error: Su Usuario o Contraseña es erradas", ToastLength.Long).Show ();
}
};
try {
Account[] accounts = AccountManager.Get (this).GetAccountsByType ("com.google");
foreach (Account account in accounts) {
if (!string.IsNullOrEmpty (account.Name)) {
TxtLogin.Text = account.Name;
return;
}
//accountsList.add(item);
}
} catch (Exception) {
return;
}
}
示例13: OnCreateDialog
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Begin building a new dialog.
this.SetStyle(DialogFragmentStyle.Normal,Android.Resource.Style.ThemeDialog);
var builder = new AlertDialog.Builder (this.Activity);
//Get the layout inflater
var inflater = Activity.LayoutInflater;
var view = inflater.Inflate(Resource.Layout.Payment, null);
txtAmt = view.FindViewById<EditText> (Resource.Id.payamt);
if (txtAmt != null) {
txtRound = view.FindViewById<EditText> (Resource.Id.payround);
txtTotal = view.FindViewById<EditText> (Resource.Id.paytotal);
txtCash = view.FindViewById<EditText> (Resource.Id.paycash);
txtChange = view.FindViewById<EditText> (Resource.Id.paychange);
Button butInvBack = view.FindViewById<Button> (Resource.Id.payok);
txtCust = view.FindViewById<EditText> (Resource.Id.newinv_custname);
txtRemark = view.FindViewById<EditText> (Resource.Id.newinv_remark);
txtInvno = view.FindViewById<EditText> (Resource.Id.newinvno);
txtRemark.Text = Remark;
txtInvno.Text = InvNo;
txtCust.Text = CustName;
txtAmt.Text = _amount.ToString ("n2");
double roundVal = 0;
double ttlAmt = Utility.AdjustToNear (_amount, ref roundVal);
txtRound.Text = roundVal.ToString ("n2");
txtTotal.Text = ttlAmt.ToString ("n2");
txtCash.EditorAction += HandleEditorAction;
txtCash.AfterTextChanged += TxtCash_AfterTextChanged;
txtCash.Text = "";
butInvBack.Visibility = ViewStates.Gone;
builder.SetView (view);
builder.SetPositiveButton (Resources.GetString(Resource.String.button_paidprint) , HandlePositiveButtonClick);
builder.SetNegativeButton (Resources.GetString(Resource.String.button_cancel),HandleNegativeButtonClick );
builder.SetNeutralButton (Resources.GetString(Resource.String.button_paid), HandlePaidOnlyButtonClick );
builder.SetCancelable (false);
txtCash.RequestFocus ();
ShowKeyBoard (view);
}
var dialog = builder.Create();
//Now return the constructed dialog to the calling activity
WindowManagerLayoutParams wmlp = dialog.Window.Attributes;
wmlp.Gravity = GravityFlags.Top | GravityFlags.Center;
return dialog;
}
示例14: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
if (!((GlobalvarsApp)this.Application).ISLOGON) {
Finish ();
}
SetContentView (Resource.Layout.CreateInvoice);
pathToDatabase = ((GlobalvarsApp)this.Application).DATABASE_PATH;
compCode = ((GlobalvarsApp)this.Application).COMPANY_CODE;
branchCode = ((GlobalvarsApp)this.Application).BRANCH_CODE;
EventManagerFacade.Instance.GetEventManager().AddListener(this);
// Create your application here
_date = DateTime.Today;
spinner = FindViewById<Spinner> (Resource.Id.newinv_custcode);
Spinner spinnerType = FindViewById<Spinner> (Resource.Id.newinv_type);
Button butSave = FindViewById<Button> (Resource.Id.newinv_bsave);
Button butNew = FindViewById<Button> (Resource.Id.newinv_cancel);
Button butFind = FindViewById<Button> (Resource.Id.newinv_bfind);
spinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
butSave.Click += butSaveClick;
butNew.Click += butCancelClick;
TextView invno = FindViewById<TextView> (Resource.Id.newinv_no);
invno.Text = "AUTO";
EditText trxdate = FindViewById<EditText> (Resource.Id.newinv_date);
trxdate.Text = _date.ToString ("dd-MM-yyyy");
trxdate.Click += delegate(object sender, EventArgs e) {
ShowDialog (0);
};
butFind.Click+= (object sender, EventArgs e) => {
ShowCustLookUp();
};
ccType = FindViewById<EditText> (Resource.Id.newinv_cctype);
ccNo = FindViewById<EditText> (Resource.Id.newinv_ccno);
ccNo.AfterTextChanged+= CcNo_AfterTextChanged;
ccNo.RequestFocus ();
apara = DataHelper.GetAdPara (pathToDatabase,compCode,branchCode);
//SqliteConnection.CreateFile(pathToDatabase);
LoadTrader ();
List<string> icodes = new List<string> ();
foreach (Trader item in items) {
icodes.Add (item.CustCode+" | "+item.CustName);
}
dataAdapter = new ArrayAdapter<String> (this, Resource.Layout.spinner_item, icodes);
dataAdapter2 =ArrayAdapter.CreateFromResource (
this, Resource.Array.trxtype, Resource.Layout.spinner_item);
// Drop down layout style - list view with radio button
dataAdapter.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
dataAdapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
// attaching data adapter to spinner
spinner.Adapter =dataAdapter;
spinnerType.Adapter =dataAdapter2;
}
示例15: Binding_TwoWayFromEditTextToEditTextWithObserveEvent_BindingGetsUpdated
public void Binding_TwoWayFromEditTextToEditTextWithObserveEvent_BindingGetsUpdated()
{
var control1 = new EditText(Application.Context);
var control2 = new EditText(Application.Context);
var binding = new Binding<string, string>(
control1,
() => control1.Text,
control2,
() => control2.Text,
BindingMode.TwoWay)
.ObserveSourceEvent(UpdateTriggerMode.LostFocus)
.ObserveTargetEvent(UpdateTriggerMode.LostFocus);
Assert.AreEqual(string.Empty, control1.Text);
Assert.AreEqual(string.Empty, control2.Text);
var value = DateTime.Now.Ticks.ToString();
control1.RequestFocus();
control1.Text = value;
Assert.AreEqual(value, control1.Text);
Assert.AreEqual(string.Empty, control2.Text);
control1.ClearFocus();
Assert.AreEqual(control1.Text, control2.Text);
var newValue = value + "Suffix";
control2.RequestFocus();
control2.Text = newValue;
Assert.AreEqual(newValue, control2.Text);
Assert.AreEqual(value, control1.Text);
control2.ClearFocus();
Assert.AreEqual(control2.Text, control1.Text);
}