繁体   English   中英

android scrollview无法正常工作windowSoftInputMode

[英]android scrollview not working windowSoftInputMode

我有一个活动,在此活动的窗口中,SoftInputMode为stateAlwaysHidden

android:windowSoftInputMode="stateAlwaysHidden"

我创建了自定义Xml文件,在此xml中,我在顶部位置有一个edittext,在底部位置有一个按钮

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<RelativeLayout

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:minHeight="@dimen/u_base_min_height">

    <LinearLayout

        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#ffffff"
        android:minHeight="@dimen/u_base_min_height"
        android:orientation="vertical">


        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="@dimen/transfer_headerView_height">

            <EditText

                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true" />
        </RelativeLayout>


    </LinearLayout>

    <LinearLayout
        android:id="@+id/bottom_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:orientation="vertical"
        android:paddingLeft="@dimen/u_common_margin_left"
        android:paddingRight="@dimen/u_common_margin_right">


        <Button
            android:id="@+id/u_done"
            android:layout_width="fill_parent"
            android:layout_height="@dimen/u_widget_height"
            android:background="@drawable/rounded_corners_blue"
            android:text="@string/u_register_next"
            android:textColor="#ffffff"
            android:textSize="@dimen/u_common_text_size" />


        <View
            android:layout_width="match_parent"
            android:layout_height="@dimen/u_common_margin_left" />


    </LinearLayout>
</RelativeLayout>

当键盘显示时,我无法显示我的按钮是否处于最低位置,scrollview现在可以工作了。 我搜索了我的问题,然后尝试更改清单文件android:windowSoftInputMode="adjustResize"

但是我不需要此解决方案,因为当键盘显示时我的按钮将键盘向上移动...我该如何解决我的问题? 如果有人知道解决方案,请帮助我,谢谢大家

为此使用下面的代码

      <android.support.v4.widget.NestedScrollView
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:isScrollContainer="true">

将您的底部按钮放在滚动视图之外。 进行两个单独的布局。 在上部布局中,放置您的滚动视图内容,在下部布局中,放置您的底部按钮。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM