Пример #1
0
            public DroidTextView( )
            {
                TextView = new BorderedRectEditText(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                TextView.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                TextView.SetScrollContainer(true);
                TextView.InputType |= Android.Text.InputTypes.TextFlagMultiLine;
                TextView.SetHorizontallyScrolling(false);
                TextView.Gravity = GravityFlags.Top | GravityFlags.Left;
                TextView.SetFilters(new IInputFilter[] { new InputFilter(int.MaxValue)
                                                         {
                                                             Parent = this
                                                         } });

                // create a dummy view that can take focus to de-select the text field

                /*DummyView = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                 * DummyView.Focusable = true;
                 * DummyView.FocusableInTouchMode = true;
                 *
                 * // let the dummy request focus so that the edit field doesn't get it and bring up the keyboard.
                 * DummyView.RequestFocus();*/

                /*TextView.EditorAction += (object sender, Android.Widget.TextView.EditorActionEventArgs e ) =>
                 * {
                 *      Rock.Mobile.Util.Debug.WriteLine( "onEdit!" );
                 *      //OnEditCallback( this );
                 * };*/

                // use reflection to get a reference to the TextView's cursor resource
                if (CursorResource == null)
                {
                    CursorResource            = Java.Lang.Class.ForName("android.widget.TextView").GetDeclaredField("mCursorDrawableRes");
                    CursorResource.Accessible = true;
                }
            }
Пример #2
0
            public DroidTextField( )
            {
                TextField = new BorderedRectEditText(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                TextField.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                TextField.SetScrollContainer(false);
                TextField.SetMaxLines(1);
                TextField.SetSingleLine( );

                TextField.SetHorizontallyScrolling(false);

                // use reflection to get a reference to the TextField's cursor resource
                if (CursorResource == null)
                {
                    CursorResource            = Java.Lang.Class.ForName("android.widget.TextView").GetDeclaredField("mCursorDrawableRes");
                    CursorResource.Accessible = true;
                }
            }