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


C# EditText.SetMinWidth方法代码示例

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


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

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.TransactionEdit);
            hScroll = FindViewById<LinearLayout>(Resource.Id.hScroll);
            txtTitle = FindViewById<EditText>(Resource.Id.txtTitle);
            txtTransactionDate = FindViewById<EditText>(Resource.Id.txtTransactionDate);
            txtTransactionDate.Click+=txtTransactionDate_Click;
            txtComments = FindViewById<EditText>(Resource.Id.txtComments);
            chkIsActive = FindViewById<CheckBox>(Resource.Id.chkIsActive);
            txtTotal = FindViewById<TextView>(Resource.Id.txtTotal);
            txtComments.SetMinWidth(WindowManager.DefaultDisplay.Width);

            FindViewById<Button>(Resource.Id.btnSave).Click += btnSave_Click;
            transaction_id = Intent.GetStringExtra("transaction_id");
            if (Convert.ToString(Intent.GetStringExtra("account_id")) == "")
                throw new Exception("cannot create or edit a transaction without an account");
            //create amount inputs
            var t = new TableLayout(this);
            t.StretchAllColumns = true;
            foreach (Fund f in Db.getFunds())
            {
                var tr = new TableRow(this);
                var lbl = new TextView(this);
                lbl.Text = f.fund_name;
                var txt = new EditText(this);
                txt.SetMinWidth(50);
                amounts.Add(txt);
                txt.AfterTextChanged += Amount_Change;
                txt.Tag = f.fund_id;
                tr.AddView(lbl);
                tr.AddView(txt);
                t.AddView(tr);
            }
            hScroll.AddView(t);
            //load fields from database
            if (transaction_id == "")
            {
                account_id = Intent.GetStringExtra("account_id");
                txtTransactionDate.Text=DateTime.Now.ToShortDateString();
            }
            else
            {
                var transaction = Db.getTransaction(transaction_id);
                chkIsActive.Checked = transaction.is_active == "1";
                txtComments.Text = transaction.transaction_comment;
                txtTitle.Text = transaction.transaction_title;
                txtTransactionDate.Text = transaction.transaction_date.ToShortDateString();
                account_id = transaction.account_id;
                var details = Db.getTransactionDetails(transaction_id);
                foreach (TransactionDetail td in details)
                {
                    foreach (EditText et in amounts)
                    {
                        if (Convert.ToString(et.Tag) == td.fund_id)
                            et.Text = td.comment;
                    }
                }

            }

            Android.Util.Log.Info("account_id", account_id);
        }
开发者ID:802701ad,项目名称:PennyPincherAndroid,代码行数:64,代码来源:ActivityTransactionEdit.cs


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