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


C# EditText.SetMaxWidth方法代码示例

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


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

示例1: RefreshTable

        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow.LayoutParams lpRow = new TableRow.LayoutParams ();
            lpRow.Height = TableLayout.LayoutParams.WrapContent;
            lpRow.Width = TableLayout.LayoutParams.WrapContent;
            lpRow.Gravity = GravityFlags.Center;

            //header
            TableRow trHeader = new TableRow (Activity);
            TextView tvHDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
            //tvHDrug.SetTextAppearance (Activity, Resource.Style.text_header_large);
            tvHDrug.Text = "Препараты";
            tvHDrug.LayoutParameters = lpRow;
            ((TableRow.LayoutParams)tvHDrug.LayoutParameters).SetMargins (0, 0, ToDIP(1) , 0);
            tvHDrug.SetBackgroundColor (Android.Graphics.Color.White);
            trHeader.AddView (tvHDrug);

            int i = 0;

            TableRow.LayoutParams lpValue = new TableRow.LayoutParams ();
            lpValue.Height = TableLayout.LayoutParams.WrapContent;
            lpValue.Width = TableLayout.LayoutParams.WrapContent;
            lpValue.Gravity = GravityFlags.Center;
            lpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

            foreach (var drug in drugs) {

                i++;

                TableRow trRow = new TableRow (Activity);
                TextView tvDrug = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoDrugItem, null);
                tvDrug.Gravity = GravityFlags.CenterVertical;
                tvDrug.SetTextAppearance (Activity, Resource.Style.text_row_large);
                tvDrug.Text = string.Format(@"{0}: {1}", i, drug.fullName);
                tvDrug.LayoutParameters = lpRow;
                tvDrug.SetBackgroundColor (Android.Graphics.Color.White);
                trRow.AddView (tvDrug);

                foreach (var info in infos) {

                    if (trHeader.Parent == null) {
                        TextView tvHInfo = (TextView)layoutInflater.Inflate(Resource.Layout.DrugInfoValueHeader, null);
                        tvHInfo.Text = info.name;
                        tvHInfo.SetBackgroundColor (Android.Graphics.Color.White);
                        trHeader.AddView (tvHInfo);
                    }

                    RelativeLayout rlValue = new RelativeLayout(Activity);
                    rlValue.SetGravity (GravityFlags.Center);
                    rlValue.SetMinimumHeight (ToDIP(64));
                    rlValue.SetMinimumWidth (ToDIP(64));
                    rlValue.LayoutParameters = lpValue;

                    rlValue.SetTag (Resource.String.IDinfo, info.id);
                    rlValue.SetTag (Resource.String.IDdrug, drug.id);
            //					rlValue.SetTag (Resource.String.IDattendance, attendace.id);

                    string value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);

                    if (info.valueType == @"number") {
                        RelativeLayout.LayoutParams nlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        nlpValue.AddRule (LayoutRules.CenterInParent);
                        nlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = nlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.ClassNumber;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += NumberValue_AfterTextChanged;
                    }

                    if (info.valueType == @"decimal") {
                        RelativeLayout.LayoutParams dlpValue = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.WrapContent, RelativeLayout.LayoutParams.MatchParent);
                        dlpValue.AddRule (LayoutRules.CenterInParent);
                        dlpValue.SetMargins (ToDIP(1), ToDIP(1), ToDIP(1), ToDIP(1));

                        EditText evValue = new EditText (Activity) { LayoutParameters = dlpValue };
                        evValue.SetMinimumWidth (ToDIP(64));
                        evValue.SetMaxWidth (ToDIP(64));
                        evValue.InputType = Android.Text.InputTypes.NumberFlagDecimal;
                        evValue.Text = value.Equals (@"N") ? string.Empty : value;
                        rlValue.AddView (evValue);
                        evValue.AfterTextChanged += DecimalValue_AfterTextChanged;
                    }

                    if (info.valueType == @"boolean") {
                        rlValue.Click += Rl_Click;

                        TextView tvValue = new TextView (Activity);
                        tvValue.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals (@"N")) {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_danger);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightPink);
                        } else {
                            tvValue.SetTextAppearance (Activity, Resource.Style.text_success);
                            rlValue.SetBackgroundColor (Android.Graphics.Color.LightGreen);
//.........这里部分代码省略.........
开发者ID:pafik13,项目名称:SBL-CRM,代码行数:101,代码来源:DrugInfoFragment.cs


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