当软键盘弹出时如何修复底部相对布局?

13

我在我的应用程序中编辑文本时,软键盘会出现,并伴随着一个底部相对布局。我想把底部相对布局的位置固定下来。任何帮助都将不胜感激。

4个回答

21

我猜Padma Kumar的意思是在你的清单活动标记上使用android:windowSoftInputMode="adjustNothing"


2
啧啧,这个怎么会有这么多赞?adjustNothing甚至都不是一个选项 - http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft - Abhijit

1

在manifest.xml文件中的activity标签中添加此内容

android:softinputmode="adjustNothing"

1
我只想修复底部布局。同时,所有其他视图都应该是可调整的,也就是说我的编辑文本应该对用户完全可见。 - hacker
我也在寻找与@hacker相同类型的解决方案。 - Akash Raghav

1
创建一个任意高度的假布局,然后引用它:
<RelativeLayout
   android:id="@+id/rl_fake"
   android:layout_width="fill_parent"
   android:layout_height="320dp" >
</RelativeLayout>

<RelativeLayout
   android:id="@+id/rl_main_view"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content" >
   ...
</RelativeLayout>
...
<RelativeLayout
   android:id="@+id/rl_problem"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:layout_alignParentBottom="true"
   android:layout_below="@+id/rl_fake" >
   ...
</RelativeLayout>

0
在相对布局中粘贴以下代码。
  <LinearLayout
        android:id="@+id/ll_button"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:gravity="center"
        android:orientation="horizontal"
        android:layout_marginTop="@dimen/_16dp">

        <Button
            android:id="@+id/btn_continue"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:text="@string/conti"
            android:padding="@dimen/_8dp"
            android:textColor="@color/white"
            android:textSize="@dimen/_16sp" />
    </LinearLayout>

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接