当前位置: 首页>>代码示例>>C#>>正文


C# EditText.SetSelectAllOnFocus方法代码示例

本文整理汇总了C#中EditText.SetSelectAllOnFocus方法的典型用法代码示例。如果您正苦于以下问题:C# EditText.SetSelectAllOnFocus方法的具体用法?C# EditText.SetSelectAllOnFocus怎么用?C# EditText.SetSelectAllOnFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EditText的用法示例。


在下文中一共展示了EditText.SetSelectAllOnFocus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetView


//.........这里部分代码省略.........
                //            Shopping.UpdateShopCar(goo_code, (int)(li_piece * li_spec));
                //        money.Text = Shopping.Get_GooTotalAll();
                //    }
                //};
                //num.FocusChange += delegate
                //{
                //    if (!num.HasFocus)
                //    {
                //        try
                //        {
                //            li_num = int.Parse(num.Text.Trim());
                //        }
                //        catch
                //        {
                //            piece.Text = ""; num.Text = "";
                //            return;
                //        }
                //        piece.Text = (li_num / li_spec).ToString();
                //        if (dataTable.Rows[position]["getdetail_memo"].ToString() == "买赠")
                //            SysVisitor.gooNum = (int)li_num;
                //        else
                //            Shopping.UpdateShopCar(goo_code, (int)li_num);
                //        money.Text = Shopping.Get_GooTotalAll();
                //    }
                //};
                #endregion
                num.Click += delegate
                {
                    var et_text = new EditText(context);
                    if (num.Text != "")
                    {
                        et_text.Text = num.Text;
                        //et_text.SetSelection(num.Text.Length);//光标移到末尾??无效??
                        et_text.SetSelectAllOnFocus(true);
                    }
                    et_text.InputType = Android.Text.InputTypes.ClassPhone;
                    AlertDialog.Builder builder = new AlertDialog.Builder(context);
                    builder.SetTitle("请输入数量:");
                    builder.SetView(et_text);
                    builder.SetPositiveButton("确定", delegate
                    {
                        if (et_text.Text != "")
                        {
                            num.Text = et_text.Text;
                            try
                            {
                                li_num = int.Parse(num.Text.Trim());
                            }
                            catch
                            {
                                piece.Text = ""; num.Text = "";
                                return;
                            }
                            piece.Text = (li_num / li_spec).ToString("##0.#");
                            if (dataTable.Rows[position]["getdetail_memo"].ToString() == "买赠")
                                Shopping.UpdateShopCar(goo_code, (int)li_num, true);//SysVisitor.gooNum = (int)li_num;
                            else
                                Shopping.UpdateShopCar(goo_code, (int)li_num);
                            money.Text = Shopping.Get_GooTotalAll();
                        }
                    });
                    builder.Show();
                    //if (dataTable.Rows[position]["getdetail_memo"].ToString() == "买赠")
                    //    new Core.KeyboardNum(activity, goo_code, pageIndex, true);
                    //else
                    //    new Core.KeyboardNum(activity, goo_code, pageIndex);
开发者ID:eatage,项目名称:AppTest,代码行数:67,代码来源:Replenishment.cs

示例2: GetView

            public override View GetView(int position, View convertView, ViewGroup parent)
            {
                if (convertView != null)
                    return convertView;
                LayoutInflater mInflater = LayoutInflater.From(context);
                View view = null;
                view = mInflater.Inflate(Resource.Layout.OrderSave_Item, null);
                int li_num = 0;//支数
                Decimal li_piece = 0;//件数
                int li_spec = 1;//每件支数
                string goo_code = dataTable.Rows[position]["goo_code"].ToString();
                Decimal li_price = 0;
                try { li_price = Convert.ToDecimal(dataTable.Rows[position]["price"]); }
                catch
                {
                    dataTable.Rows[position]["price"] = "0.00";
                }
                Decimal lde_Total_Temp = 0;
                try { lde_Total_Temp = Convert.ToDecimal(dataTable.Rows[position]["Total"]); }
                catch
                {
                    dataTable.Rows[position]["Total"] = "0.00";
                }
                Decimal lde_Price = 0;
                try { lde_Price = Convert.ToDecimal(dataTable.Rows[position]["price"]); }
                catch { }
                try
                {
                    string spec = dataTable.Rows[position]["spec"].ToString();
                    li_spec = int.Parse(spec.Trim().Replace("1*", ""));
                }
                catch { }
                TextView goo_name = view.FindViewById<TextView>(Resource.Id.OrderSave_goo_name);
                TextView goo_unit = view.FindViewById<TextView>(Resource.Id.OrderSave_goo_unit);
                TextView type = view.FindViewById<TextView>(Resource.Id.OrderSave_type);//属性(正常)
                TextView price = view.FindViewById<TextView>(Resource.Id.OrderSave_btn_price);//总价
                TextView piece = view.FindViewById<TextView>(Resource.Id.OrderSave_btn_piece);//件
                TextView num = view.FindViewById<TextView>(Resource.Id.OrderSave_btn_num);//支
                LinearLayout add = view.FindViewById<LinearLayout>(Resource.Id.OrderSave_btn_add);
                LinearLayout sub = view.FindViewById<LinearLayout>(Resource.Id.OrderSave_btn_sub);
                LinearLayout del = view.FindViewById<LinearLayout>(Resource.Id.OrderSave_btn_Del);
                TextView Unitprice = view.FindViewById<TextView>(Resource.Id.Replenishment_Unitprice);//单价
                TextView GiveNum = view.FindViewById<TextView>(Resource.Id.OrderSave_giveNum);
                GiveNum.Text = dataTable.Rows[position]["givenum"].ToString() + "支";
                goo_name.Text = dataTable.Rows[position]["goo_name"].ToString();
                goo_unit.Text = dataTable.Rows[position]["spec"].ToString() + dataTable.Rows[position]["Goo_unit"].ToString();
                type.Text = dataTable.Rows[position]["getdetail_memo"].ToString();
                price.Text = "¥" + lde_Total_Temp.ToString("##0.00");
                num.Text = Shopping.Get_GooNum(goo_code) + "支";
                piece.Text = (Convert.ToDecimal(Shopping.Get_GooNum(goo_code)) / li_spec).ToString("##0.#") + "件";
                Unitprice.Text = lde_Price.ToString("##0.00");
                //sub.Visibility = ViewStates.Invisible;
                //add.Visibility = ViewStates.Invisible;
                //piece.Enabled = false;
                //num.Enabled = false;
                num.SetTextColor(Android.Graphics.Color.ParseColor("#FF0000"));
                piece.SetTextColor(Android.Graphics.Color.ParseColor("#FF0000"));
                if (dataTable.Rows[position]["getdetail_memo"].ToString() == "买赠")
                {
                    num.Text = Shopping.Get_GooNum(goo_code, true) + "支";
                    piece.Text = (Convert.ToDecimal(Shopping.Get_GooNum(goo_code, true)) / li_spec).ToString("##0.#") + "件";

                    goo_name.SetTextColor(Android.Graphics.Color.ParseColor("#FF0000"));
                    type.SetTextColor(Android.Graphics.Color.ParseColor("#FF0000"));
                    goo_unit.SetTextColor(Android.Graphics.Color.ParseColor("#FF0000"));
                }
                GiveNum.Click += delegate
                {
                    var et_text = new EditText(context);
                    if (GiveNum.Text != "")
                    {
                        et_text.Text = GiveNum.Text.Replace("支", "").Replace("件", "");
                        //et_text.SetSelection(et_text.Text.Length);//光标移到末尾??无效??
                        et_text.SetSelectAllOnFocus(true);
                    }
                    et_text.InputType = Android.Text.InputTypes.ClassPhone;
                    AlertDialog.Builder builder = new AlertDialog.Builder(context);
                    builder.SetTitle("请输入数量:");
                    builder.SetView(et_text);
                    builder.SetPositiveButton("确定", delegate
                    {
                        if (et_text.Text != "")
                        {
                            GiveNum.Text = et_text.Text;
                            try
                            {
                                li_num = int.Parse(GiveNum.Text.Trim());
                            }
                            catch
                            {
                                GiveNum.Text = "";
                                return;
                            }
                            Shopping.UpdateShopCar(goo_code, (int)li_num, true);//SysVisitor.gooNum = (int)li_num;
                            GiveNum.Text = li_num + "支";
                        }
                    });
                    builder.Show();
                };
                del.Click += delegate
//.........这里部分代码省略.........
开发者ID:eatage,项目名称:AppTest,代码行数:101,代码来源:OrderSave.cs


注:本文中的EditText.SetSelectAllOnFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。