您的位置:首页 > 移动开发 > Android开发

关于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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息