1. <tfoot id='14n7f'></tfoot>

      <i id='14n7f'><tr id='14n7f'><dt id='14n7f'><q id='14n7f'><span id='14n7f'><b id='14n7f'><form id='14n7f'><ins id='14n7f'></ins><ul id='14n7f'></ul><sub id='14n7f'></sub></form><legend id='14n7f'></legend><bdo id='14n7f'><pre id='14n7f'><center id='14n7f'></center></pre></bdo></b><th id='14n7f'></th></span></q></dt></tr></i><div id='14n7f'><tfoot id='14n7f'></tfoot><dl id='14n7f'><fieldset id='14n7f'></fieldset></dl></div>

      <small id='14n7f'></small><noframes id='14n7f'>

      • <bdo id='14n7f'></bdo><ul id='14n7f'></ul>

    1. <legend id='14n7f'><style id='14n7f'><dir id='14n7f'><q id='14n7f'></q></dir></style></legend>

      如何显示文本编辑框“over"屏幕?

      时间:2024-04-14

        • <tfoot id='YCWPJ'></tfoot>

          • <bdo id='YCWPJ'></bdo><ul id='YCWPJ'></ul>

              <legend id='YCWPJ'><style id='YCWPJ'><dir id='YCWPJ'><q id='YCWPJ'></q></dir></style></legend>
              <i id='YCWPJ'><tr id='YCWPJ'><dt id='YCWPJ'><q id='YCWPJ'><span id='YCWPJ'><b id='YCWPJ'><form id='YCWPJ'><ins id='YCWPJ'></ins><ul id='YCWPJ'></ul><sub id='YCWPJ'></sub></form><legend id='YCWPJ'></legend><bdo id='YCWPJ'><pre id='YCWPJ'><center id='YCWPJ'></center></pre></bdo></b><th id='YCWPJ'></th></span></q></dt></tr></i><div id='YCWPJ'><tfoot id='YCWPJ'></tfoot><dl id='YCWPJ'><fieldset id='YCWPJ'></fieldset></dl></div>
                <tbody id='YCWPJ'></tbody>

                <small id='YCWPJ'></small><noframes id='YCWPJ'>

              1. 本文介绍了如何显示文本编辑框“over"屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我有一个应用程序,其主要布局为纵向(固定为纵向),并且有一个地方可以输入文本.我想像一个横向的弹出窗口一样启动,背景图像模糊不清.我知道有一个弹出窗口小部件,但任何旋转文本编辑框的想法都会很棒.滑出键盘时将其旋转到纵向视图(仅限文本框)也可以,就像在键盘滑动上显示带有文本框的新屏幕一样.

                I have an application that has a primary layout of portrait (it is fixed as portrait), and there is one place to type in text. I would like to launch like a popup window in landscape orientation with the background image fogged out. I know there is a Popup Widget, but any ideas for rotating the text edit box would be great. Rotating it into a portrait view (text box only) when the keyboard is slid out would also work, as would showing a new screen with the text box on keyboard slide.

                推荐答案

                解决问题的最简单方法是在一个单独的 dialog 主题 Activity 中显示您的 EditText从您的主要(纵向固定)活动中启动.

                The easiest solution to your problem is to display your EditText within a separate dialog themed Activity that you launch from within your main (portrait-fixed) Activity.

                EditText Activity 的方向不应固定,因此当您滑出键盘时它会按预期旋转.

                The EditText Activity shouldn't have its orientation fixed, so it will rotate as you'd expect when you slide out the keyboard.

                创建文本输入活动

                创建一个新的 Activity,它只包含 EditText 视图和您想要包含的任何其他内容(可能是 OK/Cancel 按钮,也可能是一个标签?).在清单中将其主题设置为 Theme.Dialog.

                Create a new Activity the contains only the EditText View and anything else you want to include (probably OK / Cancel buttons and maybe a label?). Within the manifest set its theme to Theme.Dialog.

                <activity android:name="TextEntryActivity" 
                          android:label="My Activity" 
                          android:theme="@android:style/Theme.Dialog"/>
                

                通过修改前台 Activity(您的文本输入对话框)的 Window 属性来对对话框后面的 Activity 进行模糊或模糊处理.在它的 onCreate 方法中,使用 getWindow().setFlags 将模糊应用于任何背景活动.

                Fogging or Blurring the Activities behind a dialog is done by modifying the Window properties of the foreground Activity (your text entry dialog). Within it's onCreate method use getWindow().setFlags to apply blurring to any background Activities.

                getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,  
                                     WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
                

                从文本输入活动中启动和读取输入的值

                使用 startActivityForResult 启动文本输入 Activity.在该活动中调用 setResult 以使用 这篇文章.

                Use startActivityForResult to launch the text entry Activity. Within that Activity call setResult to return the text string entered within the returned intent using the techniques described in this post.

                重写 onActivityResult 方法以监听子 Activity 的结果.

                Override the onActivityResult method to listen for the result from the sub Activity.

                在暴露的键盘上触发启动

                您可以随时启动文本输入活动,但如果您希望在键盘暴露时始终显示它,您可以显式捕获此事件.

                You can launch the text entry Activity whenever you want, but if you want to always display it when the keyboard is exposed you can capture this event explicitely.

                首先将 android:configChanges 属性添加到肖像 Activity 的清单条目中.它应该被注册以监听 keyboardHidden.

                Start by adding the android:configChanges attribute to the portrait Activity's manifest entry. It should be registered to listen for keyboardHidden.

                android:configChanges="keyboardHidden"
                

                在该 Activity 中,覆盖 onConfigurationChanged 以启动文本输入 Activity.

                Within that Activity, override onConfigurationChanged to launch the text entry Activity.

                @Override
                public void onConfigurationChanged(Configuration newConfig) {  
                  Intent i = new Intent(this,TextEntryActivity.class);    
                  startActivityForResult(i, STATIC_INTEGER_VALUE);
                }
                

                在启动文本输入 Activity 之前,您可能需要使用 newConfig 变量检查确认键盘是否被暴露(而不是隐藏).

                You may want to check to confirm the keyboard is being exposed (rather than hidden) using the newConfig variable before launching the text entry Activity.

                您可能还想使用相同的技术在键盘隐藏时自动从文本输入活动返回.

                You may also want to use the same technique to automatically return from the text entry activity when the keyboard is hidden.

                这篇关于如何显示文本编辑框“over"屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何添加“写评论"/“给我们打分"我的应用程序的功能? 下一篇:弹出 UIViewController

                相关文章

                1. <tfoot id='5QOpp'></tfoot>

                    <bdo id='5QOpp'></bdo><ul id='5QOpp'></ul>
                2. <legend id='5QOpp'><style id='5QOpp'><dir id='5QOpp'><q id='5QOpp'></q></dir></style></legend>

                  <small id='5QOpp'></small><noframes id='5QOpp'>

                    <i id='5QOpp'><tr id='5QOpp'><dt id='5QOpp'><q id='5QOpp'><span id='5QOpp'><b id='5QOpp'><form id='5QOpp'><ins id='5QOpp'></ins><ul id='5QOpp'></ul><sub id='5QOpp'></sub></form><legend id='5QOpp'></legend><bdo id='5QOpp'><pre id='5QOpp'><center id='5QOpp'></center></pre></bdo></b><th id='5QOpp'></th></span></q></dt></tr></i><div id='5QOpp'><tfoot id='5QOpp'></tfoot><dl id='5QOpp'><fieldset id='5QOpp'></fieldset></dl></div>