【问题标题】:Softkeypad pushing the footer view推动页脚视图的软键盘
【发布时间】:2019-08-23 20:28:09
【问题描述】:

我尝试了Android: How do I prevent the soft keyboard from pushing my view up?中的所有内容

但没有一个对我不起作用 这是我的xml

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/footer"
        android:layout_below="@+id/header"
        android:isScrollContainer="false">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:orientation="vertical">

      <....Widgets>

     </LinearLayout>
     </scrollview>

     <com.mypackage.activities.Footer
        android:id="@+id/footer"
        android:layout_width="match_parent"
        android:layout_height="@dimen/footerHeight"
        android:layout_alignParentBottom="true"
        />

</RelativeLayout>

以及在 Manifest 文件中使用的 adjustResize、adjsutPan、adjustNothing

【问题讨论】:

  • 图片会更容易,所以我们确切地知道您所看到的以及您想要的。假设您希望键盘出现在页脚上方,您需要处于 adjustPan 模式。
  • 如果您不想让软键盘向上推动页脚视图,那么您应该使用带有 vscrollview` 的 adjustnothing 作为根布局。
  • @GabeSechan with adjustPan 页脚被推送但滚动视图不起作用
  • @AbidKhan 如果我将滚动视图设为根视图,那么页脚也会滚动,但我不想滚动页脚
  • @GabeSechan 错字 *页脚没有被推送

标签: android android-layout scrollview android-keypad


【解决方案1】:

ScrollView 设为根布局,其中也包含您的页脚布局。在Manifest 文件中使用adjustNothingwindowsoftinputmode

<ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/footer"
        android:layout_below="@+id/header"
        android:isScrollContainer="false">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="30dp"
            android:layout_marginRight="30dp"
            android:orientation="vertical">

      <....Widgets>

     </LinearLayout>

     <com.mypackage.activities.Footer
        android:id="@+id/footer"
        android:layout_width="match_parent"
        android:layout_height="@dimen/footerHeight"
        android:layout_alignParentBottom="true"/>

</RelativeLayout>
</scrollview>

【讨论】:

    猜你喜欢
    • 2016-04-04
    • 1970-01-01
    • 2013-08-10
    • 1970-01-01
    • 2013-07-19
    • 1970-01-01
    • 2011-05-11
    • 1970-01-01
    • 2018-08-28
    相关资源
    最近更新 更多