Android 软键盘推送所有视图
我正在尝试做一个聊天布局。问题是当我聚焦编辑文本时,软键盘出现并将所有内容向上推。我希望它只推送带有发送指令的底部部分,以便顶部(棕色)标题部分和带有消息的recyclerview仍然可见。facebook messenger应用程序拥有的功能。我试着将“调整平移,调整大小”和所有内容都放在清单文件中,但没有成功。这是我在无焦点时的默认布局: 当我按下编辑文本时,键盘出现,并将所有内容向上移动: 我再也看不到标题,也看不到recyclerView中的消息 基本上,我希望所有元素始终可见,所以当键盘向上推时,标题、消息和发送仍然对用户可见 这是我的布局代码:Android 软键盘推送所有视图,android,xml,user-interface,android-softkeyboard,Android,Xml,User Interface,Android Softkeyboard,我正在尝试做一个聊天布局。问题是当我聚焦编辑文本时,软键盘出现并将所有内容向上推。我希望它只推送带有发送指令的底部部分,以便顶部(棕色)标题部分和带有消息的recyclerview仍然可见。facebook messenger应用程序拥有的功能。我试着将“调整平移,调整大小”和所有内容都放在清单文件中,但没有成功。这是我在无焦点时的默认布局: 当我按下编辑文本时,键盘出现,并将所有内容向上移动: 我再也看不到标题,也看不到recyclerView中的消息 基本上,我希望所有元素始终可见,所以当键
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_profile"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true"
android:layout_marginBottom="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/iv_profile"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/img_back" />
<TextView
android:id="@+id/tv_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp" />
</LinearLayout>
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/ll_profile"
android:fillViewport="true"
android:isScrollContainer="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:id="@+id/view_line"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="@color/gray_light_trans" />
<LinearLayout
android:id="@+id/ll_send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:weightSum="10">
<EditText
android:id="@+id/et_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="9"
android:hint="Message" />
<Button
android:id="@+id/btn_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Send" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_chat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/ll_send"
android:layout_below="@id/view_line" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
在清单上的活动中使用android:WindowsofInputMode=“stateHidden”问题是我在我的应用程序活动中使用了全屏主题。当我从主基本主题中删除全屏时,它开始工作。你在清单中为
android:WindowsOfInputMode
设置了什么?正如我在文章中所写的,我尝试了在每种组合中调整平移和调整大小,仍然没有效果AdjustPan移动您的内容,但如果您设置了adjustResize或未设置任何内容,则您的内容不应移动。即使尝试删除所有内容,仍然没有效果。我试过你的代码,对我来说很好。请把你的舱单也给我们看看好吗?