This may be possible of duplicate question i have tried all things none of it works i need to make whatsapp like chat model using RecyclerView
and at the bottom EditText
and a Button
bottom my problem is i can have EditText
and bottom at the bottom but i need scroll to view that EditText
and Button
, what i should have when user enter that page EditText
and Buttonb should appear without scrolling and one more problem there is lots of space between two items in that
RecyclerView` how to reduce that space let me post what i did so far:
My Recyclerview ChatLayout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/constraint_recyclerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="4">
<EditText
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Enter Message"
android:lines="1" />
<Button
android:id="@+id/btn_send"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Send" />
</LinearLayout>
</RelativeLayout>
How to do this as am new for android development someone please help me!
答案 0 :(得分:0)
您应该将您在RecyclerViewAdapter中使用的布局中的android:height更改为wrap_content
还有你的清单
<activity
...
android:windowSoftInputMode="adjustPan"
...
></activity>
答案 1 :(得分:0)
他们有很多库。This库是一个示例Android应用程序,可用作聊天应用程序的入门应用程序。您可以在项目中参考或实现此库
答案 2 :(得分:0)
检查您的视图中使用的行项(布局xml文件)。我认为你在父视图中使用了match_parent。将其设为 wrap_content 。
对于滚动问题,请检查代码是否为smoothScrollToPosition(int)。可能是你在代码中使用过这种方法。