关于Android布局中键盘遮挡问题
2015-08-26 21:55
495 查看
关于Android布局中键盘遮挡问题
我们都一个误区,就是一直尝试着设置在AndroidManifest.xml文件中的 android:windowSoftInputMode=“”属性,但是一直不尽如人意。
经过多次尝试后发现,现在只需要将包含EditText或者EditText本身外面包裹一层ScrollView这样就可以轻松实现了
<span style="color:#ff0000;"> </span><ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<RelativeLayout
android:id="@+id/layout_send_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white" >
<Button
android:id="@+id/send_comment_btn_send"
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/shape_forget_pwd"
android:padding="3dp"
android:text="@string/video_commnet_send"
android:textColor="@color/feidiehuang"
android:textSize="12sp" />
<EditText
android:id="@+id/send_comment_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="@id/send_comment_btn_send"
android:background="@drawable/shape_send_comment"
android:ems="10"
android:inputType="none"
android:paddingLeft="10dp"
android:selectAllOnFocus="true"
android:textSize="16sp" />
</RelativeLayout>
</ScrollView>
我们都一个误区,就是一直尝试着设置在AndroidManifest.xml文件中的 android:windowSoftInputMode=“”属性,但是一直不尽如人意。
经过多次尝试后发现,现在只需要将包含EditText或者EditText本身外面包裹一层ScrollView这样就可以轻松实现了
<span style="color:#ff0000;"> </span><ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<RelativeLayout
android:id="@+id/layout_send_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white" >
<Button
android:id="@+id/send_comment_btn_send"
android:layout_width="50dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/shape_forget_pwd"
android:padding="3dp"
android:text="@string/video_commnet_send"
android:textColor="@color/feidiehuang"
android:textSize="12sp" />
<EditText
android:id="@+id/send_comment_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:layout_toLeftOf="@id/send_comment_btn_send"
android:background="@drawable/shape_send_comment"
android:ems="10"
android:inputType="none"
android:paddingLeft="10dp"
android:selectAllOnFocus="true"
android:textSize="16sp" />
</RelativeLayout>
</ScrollView>
相关文章推荐
- Android实现表情 抓取新浪表情
- 详解Android解析Xml的三种方式——DOM、SAX以及XMLpull
- android开发环境遇到adt无法启动的问题分析及解决方法
- Android开发 旋转屏幕导致Activity重建解决方法
- Android开发技巧之在a标签或TextView控件中单击链接弹出Activity(自定义动作)
- Android开发技巧之ViewStub控件惰性装载
- 分享10个很棒的学习Android开发的网站
- android开发之横向滚动/竖向滚动的ListView(固定列头)
- Android开发技巧之我的菜单我做主(自定义菜单)
- Windows下使用Apache Cordova开发ANDROID之HelloWorld
- 根据根据图片的url怎么取得图片ImageView对象
- [转] ADB server didn't ACK
- android开发的相关链接
- Android数据存储之SharedPreferences 共享首选项/偏好设置
- 基于NDK的Android防破解
- 麦子学院android开发笔记:Android更换RatingBar图片
- android开发入门知识之AIDL详解
- android开发学习如何一体化?从入门到高端开发的路如何走?
- Android入门到精通详解 电子书下载
- --暴走漫画系列--高仿淘宝收货地址(附demo)