The problem is the following: There is the first layout1, on top of it, below layout2, when I click on the button I change layout2.setVisibility (VISIBLE), thereby showing layout2 only it covers the part of the list which is not visible at the bottom and elements that are at the bottom simply not visible no. How to make layout1 shrink when layout2 appears or how to cram it into a SnackBar ?? Thank you in advance

<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:fab="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.example.kombo.eplog.fragments.FragmentMusic"> <LinearLayout android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipeController" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.RecyclerView android:id="@+id/musiclist" android:layout_width="match_parent" android:layout_height="wrap_content" ></android.support.v7.widget.RecyclerView> </android.support.v4.widget.SwipeRefreshLayout> </LinearLayout> <LinearLayout android:id="@+id/info_panel" android:layout_width="match_parent" android:layout_height="65dp" android:layout_alignParentBottom="true" android:orientation="vertical"> <LinearLayout android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:background="@color/colorDevider"></LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:weightSum="13"> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="2.6" android:background="?android:colorBackground"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerInParent="true" android:layout_marginBottom="5dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="5dp" android:background="@drawable/corners_background" android:scaleType="center" android:src="@drawable/note_48x48" /> </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1.85" android:background="?android:colorBackground" android:orientation="vertical"> <TextView android:id="@+id/bottom_name_of_composition" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginTop="5dp" android:ellipsize="marquee" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLine="true" android:text="Любов і сон" android:textColor="#000000" android:textSize="21sp" /> <TextView android:id="@+id/bottom_name_of_artist" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:layout_marginTop="5dp" android:text="Авет Макарян" android:textSize="15sp" /> </LinearLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="2.85"> <ImageButton android:id="@+id/skip_prev" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?android:colorBackground" android:src="@drawable/ic_skip_previous_40dp" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="2.85"> <ImageButton android:id="@+id/pl_pause" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?android:colorBackground" android:src="@drawable/ic_play_arrow_40dp" /> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="2.85"> <ImageButton android:id="@+id/skip_nxt" android:layout_width="match_parent" android:layout_height="match_parent" android:background="?android:colorBackground" android:src="@drawable/ic_skip_next_40dp" /> </RelativeLayout> </LinearLayout> </LinearLayout> </LinearLayout> 

enter image description here

  • one
    Show the markup code. - McDaggen
  • Parent layout NestedScrollView, place the main LinearLayout with a vertical orientation, then insert two of your LinearLayout at the first height, make wrap_content, and if you see the second line, the height of both will go beyond the screen, you can scroll - McDaggen
  • I tried and failed. The first layout is fully pulled to the top and only the strip will be repaired - Serhiy
  • Well, it will be right, with a vertical orientation, in the first liner you should have twist elements and in the second, but you will make the second programmatically visible after all - McDaggen
  • Maybe I'm a little tight, but I still don’t understand how to do it right - Serhiy

1 answer 1

Try
1) change the alpha transparency.
2) remove layout remove
3) put in RelativeLayout, and change position

  • Please clarify 2 and 3 paragraph - Serhiy
  • 2) This is to remove the removeView (view) element from the ancestor so that it would not overlap, and then add again addView (view) ;, if necessary. 3) it is to wrap the disturbing element in RelativeLayout, and if it interferes with setting setX (99999) - Devel0
  • Thank you very much))) - Serhiy