1

これは私が相対的なレイアウトを表示/非表示にしたい私のXMLレイアウトが(@ + ID/room_header_rl)いずれかがそれを行うにはどのようなアイデアを持っているactiob_bar.Pleaseではないでしょうか? 私はCoordinatorLayoutを使用してみたが、成功を取得できません。 ありがとうございます。Recycleviewのリストがスクロールしているときに相対レイアウトを非表示にすることはできますか?

私のXMLレイアウト:

<?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:background="@color/white"> 

    <include 
     android:id="@+id/app_bar" 
     layout="@layout/app_bar"/> 

    <RelativeLayout 
     android:id="@+id/room_header_rl" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/white" 
     android:padding="10dp" 
     android:layout_below="@+id/app_bar" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true"> 

     <RelativeLayout 
      android:id="@+id/room_details_rl" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <ImageView 
       android:id="@+id/room_img" 
       android:layout_width="80dp" 
       android:layout_height="80dp" 
       android:layout_marginRight="10dp" 
       android:scaleType="centerCrop" 
       android:layout_centerVertical="true"/> 

      <RelativeLayout 
       android:id="@+id/rooom_rl" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/room_img" 
       android:layout_centerVertical="true"> 

       <TextView 
        android:id="@+id/roomname_tv" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="@color/black" 
        android:textSize="15sp" 
        android:textStyle="bold" 
        android:maxLines="2" 
        android:drawablePadding="5dp"/> 

       <TextView 
        android:id="@+id/roomdate_tv" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="@color/black" 
        android:layout_below="@+id/roomname_tv" 
        android:layout_marginTop="10dp"/> 

       <EditText 
        android:id="@+id/roommembers_tv" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textColor="@color/black" 
        android:textSize="14sp" 
        android:layout_below="@+id/roomdate_tv" 
        android:focusable="false"/> 

      </RelativeLayout> 

     </RelativeLayout> 

     <TextView 
      android:id="@+id/welcome_msg_txt" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:maxLines="4" 
      android:padding="5dp" 
      android:gravity="center" 
      android:textStyle="bold" 
      android:background="@color/light_gray" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:layout_marginTop="10dp" 
      android:layout_below="@+id/room_details_rl" 
      android:layout_centerHorizontal="true" /> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="1dp" 
      android:layout_marginTop="5dp" 
      android:background="@color/gray" 
      android:layout_below="@+id/welcome_msg_txt"/> 

    </RelativeLayout> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/roomchat_rv" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_marginBottom="5dp" 
     android:layout_marginTop="20dp" 
     android:layout_above="@+id/divider" 
     android:layout_below="@+id/room_header_rl"/> 

    <View 
     android:id="@+id/divider" 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:background="@color/gray" 
     android:layout_above="@+id/entertext_rl"/> 

<RelativeLayout 
    android:id="@+id/entertext_rl" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true"> 

    <EditText 
     android:id="@+id/entertext_ed" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textColor="@color/black" 
     android:layout_marginTop="5dp" 
     android:layout_marginBottom="5dp" 
     android:layout_marginLeft="5dp" 
     android:maxLines="3" 
     android:textSize="16sp" 
     android:capitalize="sentences" 
     android:hint="@string/entertext" 
     android:layout_toLeftOf="@id/attech_btn" 
     android:background="@android:color/transparent" 
     android:layout_centerVertical="true"/> 

    <Button 
     android:id="@+id/attech_btn" 
     android:layout_width="30dp" 
     android:layout_height="30dp" 
     android:layout_centerVertical="true" 
     android:layout_marginRight="10dp" 
     android:layout_toLeftOf="@+id/send_btn" 
     android:background="@drawable/attach"/> 

    <Button 
     android:id="@+id/send_btn" 
     android:layout_width="30dp" 
     android:layout_height="30dp" 
     android:layout_centerVertical="true" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="10dp" 
     android:background="@drawable/send_btn"/> 

</RelativeLayout> 

私はhttps://mzgreen.github.io/2015/06/23/How-to-hideshow-Toolbar-when-list-is-scrolling%28part3%29/をしようとしていますが、それはショー/のみアクションバーを非表示にします。

答えて

1

あなたはプログラム的にそれを隠そうとしましたか?

recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { 
     @Override 
     public void onScrolled(RecyclerView recyclerView, int dx, int dy) { 
      super.onScrolled(recyclerView, dx, dy); 
      my_relative_layout.setVisibility(View.GONE); 
     } 
    }); 
+0

それは単にレイアウトがアップとダウンのようなレイアウトは、アニメーションを表示しない非表示にします。これは私の質問のための適切な解決策ではありません。 –

+0

あなたはツールバーと同じ動作をしたいですか? – Boukharist

+0

はいツールバーアニメーションと同じ –

関連する問題