2016-10-08 3 views
-2

チャットルームアクティビティでは、リサイクルビューアイテムがテキストビューに表示されます。データアイテムが増加すると、テキストビュー。リサイクラビューでデータアイテムが増加すると、リサイクルビューデータがテキストビューに表示される

Below is the screenshot

activty_chatroom.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    tools:context="com.boosterfoxindia.foxindtracker.ChatRoomActivity"> 

    <!--<TextView--> 
     <!--android:layout_width="wrap_content"--> 
     <!--android:layout_height="wrap_content"--> 
     <!--android:text="" --> 
     <!--android:id="@+id/tvChat"/>--> 

    <android.support.v7.widget.RecyclerView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/rvCM" 
     app:stackFromEnd="true"></android.support.v7.widget.RecyclerView> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:weightSum="7" 
     android:layout_alignParentBottom="true" 
     android:layout_marginTop="10dp" 
     android:layout_marginBottom="10dp" 
     android:padding="0dp" 
     android:gravity="center" 
     > 

     <EditText 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:id="@+id/etMessage" 
      android:layout_weight="6" 
      android:background="@drawable/chattextbox" 
      android:padding="10dp" 
      android:hint="Enter message..." 
      android:elevation="2dp" 
      android:layout_gravity="center" 
      android:layout_marginTop="10dp"/> 


     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:id="@+id/btnSend" 
      android:background="@drawable/circle" 
      android:orientation="vertical" 
      android:gravity="center" 
      android:layout_gravity="center" 
      android:layout_marginTop="10dp" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:layout_marginBottom="0dp"> 

      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:src="@mipmap/ic_send_white_24dp" 
       android:layout_gravity="center" 
       android:padding="10dp" 
       /> 



     </LinearLayout> 


    </LinearLayout> 
</RelativeLayout> 

私はので、私はあなたが変更する必要があり、私は、私を助けてください

+0

あなたitem.xmlを投稿してください.... item.xmlにおけるいくつかの変更がitem.xmlが、私はあなたを取得しdid'nt – sushildlh

+0

必要です。.. –

答えて

1

属性このandroid:id="@+id/LLMain"ようLinear Layoutからidと、このプロパティandroid:layout_above="@+id/LLMain"を使用してRecycler Viewにそれを与える.ANDもRecyclerviewheightmatch parentを与えます。

このXMLと似ています。

<android.support.v7.widget.RecyclerView 
     android:id="@+id/rvCM" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_above="@+id/LLMain" 
     app:stackFromEnd="true" /> 

    <LinearLayout 
     android:id="@+id/LLMain" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_marginBottom="5dp" 
     android:layout_marginTop="5dp" 
     android:gravity="center" 
     android:orientation="horizontal" 
     android:padding="0dp" 
     android:weightSum="7"> 
0

まず間違っていますどこことを認識していないです、アンドロイドアプリケーションで初心者ですRelativeLayoutLinearLayout(縦)次にRecyclerViewを新しいlinear_layoutに入れて、特性をandroid:layout_weight="3"に設定します。あなたが望むように、このコードに従ってください。

<!--<TextView--> 
<!--android:layout_width="wrap_content"--> 
<!--android:layout_height="wrap_content"--> 
<!--android:text="" --> 
<!--android:id="@+id/tvChat"/>--> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/linearLayout4" 
     android:layout_weight="3" 
     android:splitMotionEvents="false"> 
     <android.support.v7.widget.RecyclerView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/rvCM" 
      app:stackFromEnd="true" /> 
    </LinearLayout> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_alignParentBottom="true" 
     android:layout_marginTop="10dp" 
     android:layout_marginBottom="10dp" 
     android:padding="0dp" 
     android:gravity="center" 
     android:layout_weight="1" 
     android:splitMotionEvents="false"> 
     <EditText 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:id="@+id/etMessage" 
      android:layout_weight="6" 
      android:background="@drawable/chattextbox" 
      android:padding="10dp" 
      android:hint="Enter message..." 
      android:elevation="2dp" 
      android:layout_gravity="center" 
      android:layout_marginTop="10dp" /> 
     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:id="@+id/btnSend" 
      android:background="@drawable/circle" 
      android:orientation="vertical" 
      android:gravity="center" 
      android:layout_gravity="center" 

      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:layout_marginBottom="0dp"> 
      <ImageView 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:src="@mipmap/ic_send_white_24dp" 
       android:layout_gravity="center" 
       android:padding="10dp" /> 
     </LinearLayout> 
    </LinearLayout> 
    </LinearLayout> 
1

は、次の操作を行い
1. idエディタを含むlinear layoutに追加します。
2. recycler viewlayout heightを親と一致するように変更します。
3. recyclerview

android:layout_above="@+id/editor_id" 

4にこの属性を追加し、エディタlinear layout

P.S.からweight sum属性を削除これらのケースでは、のLinearLayoutにあなたの親RelativeLayoutを変更すると、いくつかのデバイス上でクレイジーな結果を与えるかもしれないので、適切なレイアウトの位置とRelativeLayoutを使用し、私はあなたが与えるされて行うのに必要なものを、あなたがより多くの変更を加える必要はありませんだと思う

関連する問題