2016-09-14 17 views
0

enter image description here这是可能重复的问题我已经尝试了所有的东西都没有它的工作原理,我需要使用RecyclerView,并在底部EditText喜欢聊天模式WhatsApp的制作和Button下我的问题是,我可以在底部有EditText和底部但我需要滚动查看EditTextButton,我应该当用户进入该网页EditTextButtonb should appear without scrolling and one more problem there is lots of space between two items in that RecyclerView`如何减少空间让我发布,我所做的,到目前为止有:如何制作一个类似“RecyclerView”的WhatsApp?

我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> 

如何做到这一点为Android新的开发人员请帮助我!

+2

添加一个*截图*为您的问题更好的可视化。 – CodeWalker

+0

@CodeWalker请看看 –

+0

你的问题很难理解。真!!! – androidXP

回答

0

你应该改变了android:高度的布局,妳RecyclerViewAdapter使用WRAP_CONTENT

而且也是您的清单

<activity 
     ... 
     android:windowSoftInputMode="adjustPan" 
     ... 
></activity> 
+0

我只是在选项卡片段中使用此 –

+0

是的,也可以,只需将该配置添加到加载您的选项卡片段的活动即可。它会根据软键盘显示自动重新排列布局的高度 – faruk

0

他们有许多图书馆在那里。 This库是一个示例Android应用程序,可用作聊天应用程序的入门应用程序。您可以参考或在项目中实现此库

0

检查您的视图中使用的行项目(布局xml文件) 。我认为你在父视图中使用了match_parent。将其设为wrap_content

对于该滚动问题,请检查smoothScrollToPosition(int)的代码。可能你已经在你的代码中使用了这种方法。

+0

不,我没有使用过该方法 –

+0

你能解释一下滚动问题吗?回收站查看滚动到底部? – chathura

+0

你可以发布该方法的一些示例,所以我还没有尝试过 –

相关问题