2016-09-14 20 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

你可以發佈該方法的一些示例,所以我還沒有嘗試過 –

相關問題