知识点
相关文章
更多最近更新
更多登录界面与Android软键盘显示、隐藏的交互设计
2019-03-02 00:57|来源: 网路
在我们的Android应用中最常与Android的软键盘打交道的要属登录界面了,下面是本人感觉比较好的几个登录界面如下
1,微信
2,糗百
以上两个都是弹出软键盘之后布局上没什么变化的,也就是巧用布局正好登录的按钮不被软键盘挡到,假如我们的UI是登录按钮被挡到的情况下我们该如何处理呢?
3,陌陌
这种交互我个人感觉是很良好的。
那么这块布局是怎么处理的呢?登录页面的布局如下
1 <?xml version="1.0" encoding="utf-8"?> 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="fill_parent" 4 android:layout_height="fill_parent" 5 android:background="@color/white" > 6 7 <LinearLayout 8 android:id="@+id/layout_header" 9 android:layout_width="fill_parent" 10 android:layout_height="wrap_content" 11 android:layout_alignParentTop="true" 12 android:background="@drawable/bg_topbar" 13 android:focusable="true" /> 14 15 <LinearLayout 16 android:id="@+id/layout_content" 17 android:layout_width="fill_parent" 18 android:layout_height="fill_parent" 19 android:layout_below="@+id/layout_header" 20 android:orientation="vertical" > 21 22 <ScrollView 23 android:layout_width="fill_parent" 24 android:layout_height="fill_parent" 25 android:layout_weight="1.0" 26 android:scrollbars="vertical" > 27 28 <LinearLayout 29 android:layout_width="fill_parent" 30 android:layout_height="fill_parent" 31 android:orientation="vertical" 32 android:paddingLeft="10.0dip" 33 android:paddingRight="10.0dip" 34 android:paddingTop="15.0dip" > 35 36 <EditText 37 android:id="@+id/login_et_momoid" 38 android:layout_width="fill_parent" 39 android:layout_height="wrap_content" 40 android:layout_marginBottom="8.0dip" 41 android:background="@drawable/edittext_default" 42 android:inputType="text" 43 android:singleLine="true" /> 44 45 <EditText 46 android:id="@+id/login_et_pwd" 47 android:layout_width="fill_parent" 48 android:layout_height="wrap_content" 49 android:layout_marginBottom="8.0dip" 50 android:background="@drawable/edittext_default" 51 android:imeOptions="actionDone" 52 android:inputType="textPassword" 53 android:singleLine="true" /> 54 55 <TextView 56 android:id="@+id/login_tv_forgotpassword" 57 android:layout_width="wrap_content" 58 android:layout_height="wrap_content" 59 android:clickable="true" 60 android:text="忘记密码?" 61 android:textSize="16.0sp" /> 62 </LinearLayout> 63 </ScrollView> 64 65 <RelativeLayout style="@style/Style_BottomBar" > 66 67 <Button 68 android:id="@+id/btn_back" 69 style="@style/Style_Login_register_btn" 70 android:layout_width="wrap_content" 71 android:layout_height="wrap_content" 72 android:layout_alignParentLeft="true" 73 android:text="返回" /> 74 75 <Button 76 android:id="@+id/btn_ok" 77 style="@style/Style_Login_register_btn" 78 android:layout_width="wrap_content" 79 android:layout_height="wrap_content" 80 android:layout_alignParentRight="true" 81 android:text="登录" /> 82 </RelativeLayout> 83 </LinearLayout> 84 85 <ImageView 86 android:id="@+id/layout_shadow" 87 android:layout_width="fill_parent" 88 android:layout_height="wrap_content" 89 android:layout_below="@id/layout_header" 90 android:background="@drawable/bg_topbar_shadow" 91 android:focusable="false" /> 92 93 </RelativeLayout>
下面附上代码下载地址:http://115.com/file/bev90tpb#Imomo.zip
转自:http://www.cnblogs.com/oasis2008/archive/2012/07/24/2606210
相关问答
更多-
ui交互设计 是什么[2023-07-15]
UI即User Interface(用户界面)的简称。UI设计则是指对软件的人机交互、操作逻辑、界面美观的整体设计。 达内科技 -
您只能在代码中添加以下行: input.setRawInputType(Configuration.KEYBOARD_12KEY); 这将只显示数字键盘。 You must only add this line on your code: input.setRawInputType(Configuration.KEYBOARD_12KEY); this will show only the numeric keyboard.
-
这会帮助你 editText.setInputType(InputType.TYPE_NULL); 编辑: 要显示软键盘,您必须在long key press event of menu button编写以下代码 editText.setInputType(InputType.TYPE_CLASS_TEXT); editText.requestFocus(); InputMethodManager mgr = (InputMethodManager) get ...
-
editText_input_field.setOnTouchListener(otl); private OnTouchListener otl = new OnTouchListener() { public boolean onTouch (View v, MotionEvent event) { return true; // the listener has consumed the event } }; 来源: 如何在android中点击edittext时阻止虚拟键盘? ...
-
嗨,我使用了以下解决方法: 至于我的内容视图是LinearLayout的子类(可以是任何其他视图或视图组),我将覆盖onMeasure方法lilke以下: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { final int proposedheight = MeasureSpec.getSize(heightMeasureSpec); final int actualHeigh ...
-
Android - 如何检测屏幕中显示的软键盘[重复](Android - how to detect soft keyboard shown in the screen [duplicate])[2022-11-21]
没有直接的方法 - 请参阅http://groups.google.com/group/android-platform/browse_thread/thread/1728f26f2334c060/5e4910f0d9eb898a ,其中来自Android团队的Dianne Hackborn已回复。 但是,您可以通过检查#onMeasure中窗口大小是否更改来间接检测它。 请参阅如何检查Android中软件键盘的可见性? 。 There is no direct way - see http://group ... -
将其添加到您的代码android:focusableInTouchMode="true"将确保您的键盘在启动时没有出现在您的edittext框中。 您要将此行添加到包含EditTextBox的线性布局。 你应该可以玩这个来解决你的问题。 我已经测试了这个。 简单解决方案 即:在您的app_list_view.xml文件中
Android:如何在LinearLayout上显示软键盘(Android:how to show the soft keyboard on the LinearLayout)[2023-10-07]
制作自定义按钮效果更好,但您可以实现自己想要的效果 在您的布局中嵌入EditText并使其invisible或gone 。 使用此实用程序类以编程方式隐藏/显示键盘。 It's better to make your custom buttons, but you can achieve what you want by Embedding an EditText in your layout and make it invisible or gone. Programatically hide/show ...嗨,在输入上尝试onFocus属性,然后立即模糊()文本输入,如果你不满意,那么经过简短的搜索我得到了一个教程来做这个只是通过它可能它可以帮助你 http://www.sencha.com/forum/archive/index.php/t-141560.html?s=6853848ccba8060cc90a9cacf7f0cb44 你也可以从java脚本中调用java代码 ... WebView webView = (WebView) findViewById(R.id.webview); webView ...在On create Method中使用以下内容。 它工作正常。 this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); if ( ...