Make visible single View in RelativeLayout











up vote
0
down vote

favorite












I have a RelativeLayout which contains a LinearLayout containing 2 buttons. I would like to make those buttons visible without making the whole RelativeLayout or LinearLayout visible. While debugging, the button's getVisibility reports visible and getLocationOnScreen returns the correct placement but I can't see them. Here is my xml



<RelativeLayout
android:id="@+id/edit_div_element"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="20dp"
android:background="@drawable/full_popup_element"
android:layout_alignParentBottom="true"
android:visibility="gone"
android:layout_centerVertical="true"
android:clickable="false">

<ImageView
android:id="@+id/close_edit"
android:src="@drawable/view_edge_promotion_close_icon"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/uniform_style_blue"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="-10dp"/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/close_edit"
android:orientation="horizontal" >

<TextView
android:id="@+id/popup_name_label"
android:text="@string/popup_name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="@dimen/font_size_fixed_16" />

<EditText
android:id="@+id/popup_name"
android:hint=""
android:layout_width="170dp"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:singleLine="true"
android:textSize="18sp"
android:layout_marginLeft="15dp"
android:paddingBottom="2dp"
android:paddingLeft="@dimen/marginSmall" />

</LinearLayout>

<TextView
android:id="@+id/popup_assignment_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/edit_assignment_label"
android:layout_below="@id/popup_name_container"
android:layout_marginTop="20dp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
android:layout_below="@id/popup_assignment_label"
android:gravity="bottom"
>

<android.support.v7.widget.RecyclerView
android:id="@+id/popup_assignment_recycler"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"/>


<Button
android:id="@+id/btn_1"
android:text="@string/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/popup_assignment_recycler"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="18dp"
/>
<Button
android:id="@+id/btn_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_1"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="9dp"
/>
</LinearLayout>

</RelativeLayout>


I'm setting visibility with



Button mBtn1 = findViewById(R.id.btn_1);
mBtn1.setVisibility(View.VISIBLE);
Button mBtn2 = findViewById(R.id.btn_2);
mBtn2.setVisibility(View.VISIBLE);


I've also tried defining the RelativeLayout's visibility as INVISIBLE in the xml, still no luck.



Is it possible to just show the buttons? I'm stumped, so any help is appreciated!










share|improve this question


















  • 2




    It it not possible to have an invisible parent ViewGroup with a visible child View. So you need to redesign your layout or (if you leave it the way it is) you'll have to individually toggle the visibility of the ImageView, the RecyclerView, the popup_assignment_label TextView and the LinearLayout containing the EditText
    – 0X0nosugar
    Nov 19 at 19:56










  • Bummer, but great to know, thanks! Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:06






  • 1




    The height of the RelativeLayout will vary e.g. with the number and/ or size of items in the RecyclerView, so the position of the Buttons (which seems to be aligned to the bottom line of the RecyclerView) will have to vary as well (else you can simply set a top margin for the buttons). You can try to keep track of changes in the size of the RelativeLayout and each time set the Button position accordingly but IMO this is much more trouble than simply toggling the visiblility of six different Views as required by your app's business logic.
    – 0X0nosugar
    Nov 19 at 20:20










  • I see. My recyclerview is horizontal and has a set width, so I thought that may be straightforward. My concern with toggling visibility is, won't all of those elements show up, even if for a brief moment? To be clear, you're suggesting, a call to relativelayout.setVisibility(VISIBLE) and then toggling all of its child views to GONE? Again, thanks for the help - I've been stuck on this for too long!
    – Coleen
    Nov 19 at 20:35






  • 1




    If you're talking about setting all the child Views to GONE I'm wondering where the buttons really should show up. (Until now, I thought you wanted them to have a right margin of 180 dp and an y position dpending on the RecyclerView.) Maybe a picture would help to clarify what you're trying to achieve?
    – 0X0nosugar
    Nov 19 at 20:41















up vote
0
down vote

favorite












I have a RelativeLayout which contains a LinearLayout containing 2 buttons. I would like to make those buttons visible without making the whole RelativeLayout or LinearLayout visible. While debugging, the button's getVisibility reports visible and getLocationOnScreen returns the correct placement but I can't see them. Here is my xml



<RelativeLayout
android:id="@+id/edit_div_element"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="20dp"
android:background="@drawable/full_popup_element"
android:layout_alignParentBottom="true"
android:visibility="gone"
android:layout_centerVertical="true"
android:clickable="false">

<ImageView
android:id="@+id/close_edit"
android:src="@drawable/view_edge_promotion_close_icon"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/uniform_style_blue"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="-10dp"/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/close_edit"
android:orientation="horizontal" >

<TextView
android:id="@+id/popup_name_label"
android:text="@string/popup_name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="@dimen/font_size_fixed_16" />

<EditText
android:id="@+id/popup_name"
android:hint=""
android:layout_width="170dp"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:singleLine="true"
android:textSize="18sp"
android:layout_marginLeft="15dp"
android:paddingBottom="2dp"
android:paddingLeft="@dimen/marginSmall" />

</LinearLayout>

<TextView
android:id="@+id/popup_assignment_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/edit_assignment_label"
android:layout_below="@id/popup_name_container"
android:layout_marginTop="20dp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
android:layout_below="@id/popup_assignment_label"
android:gravity="bottom"
>

<android.support.v7.widget.RecyclerView
android:id="@+id/popup_assignment_recycler"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"/>


<Button
android:id="@+id/btn_1"
android:text="@string/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/popup_assignment_recycler"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="18dp"
/>
<Button
android:id="@+id/btn_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_1"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="9dp"
/>
</LinearLayout>

</RelativeLayout>


I'm setting visibility with



Button mBtn1 = findViewById(R.id.btn_1);
mBtn1.setVisibility(View.VISIBLE);
Button mBtn2 = findViewById(R.id.btn_2);
mBtn2.setVisibility(View.VISIBLE);


I've also tried defining the RelativeLayout's visibility as INVISIBLE in the xml, still no luck.



Is it possible to just show the buttons? I'm stumped, so any help is appreciated!










share|improve this question


















  • 2




    It it not possible to have an invisible parent ViewGroup with a visible child View. So you need to redesign your layout or (if you leave it the way it is) you'll have to individually toggle the visibility of the ImageView, the RecyclerView, the popup_assignment_label TextView and the LinearLayout containing the EditText
    – 0X0nosugar
    Nov 19 at 19:56










  • Bummer, but great to know, thanks! Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:06






  • 1




    The height of the RelativeLayout will vary e.g. with the number and/ or size of items in the RecyclerView, so the position of the Buttons (which seems to be aligned to the bottom line of the RecyclerView) will have to vary as well (else you can simply set a top margin for the buttons). You can try to keep track of changes in the size of the RelativeLayout and each time set the Button position accordingly but IMO this is much more trouble than simply toggling the visiblility of six different Views as required by your app's business logic.
    – 0X0nosugar
    Nov 19 at 20:20










  • I see. My recyclerview is horizontal and has a set width, so I thought that may be straightforward. My concern with toggling visibility is, won't all of those elements show up, even if for a brief moment? To be clear, you're suggesting, a call to relativelayout.setVisibility(VISIBLE) and then toggling all of its child views to GONE? Again, thanks for the help - I've been stuck on this for too long!
    – Coleen
    Nov 19 at 20:35






  • 1




    If you're talking about setting all the child Views to GONE I'm wondering where the buttons really should show up. (Until now, I thought you wanted them to have a right margin of 180 dp and an y position dpending on the RecyclerView.) Maybe a picture would help to clarify what you're trying to achieve?
    – 0X0nosugar
    Nov 19 at 20:41













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a RelativeLayout which contains a LinearLayout containing 2 buttons. I would like to make those buttons visible without making the whole RelativeLayout or LinearLayout visible. While debugging, the button's getVisibility reports visible and getLocationOnScreen returns the correct placement but I can't see them. Here is my xml



<RelativeLayout
android:id="@+id/edit_div_element"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="20dp"
android:background="@drawable/full_popup_element"
android:layout_alignParentBottom="true"
android:visibility="gone"
android:layout_centerVertical="true"
android:clickable="false">

<ImageView
android:id="@+id/close_edit"
android:src="@drawable/view_edge_promotion_close_icon"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/uniform_style_blue"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="-10dp"/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/close_edit"
android:orientation="horizontal" >

<TextView
android:id="@+id/popup_name_label"
android:text="@string/popup_name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="@dimen/font_size_fixed_16" />

<EditText
android:id="@+id/popup_name"
android:hint=""
android:layout_width="170dp"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:singleLine="true"
android:textSize="18sp"
android:layout_marginLeft="15dp"
android:paddingBottom="2dp"
android:paddingLeft="@dimen/marginSmall" />

</LinearLayout>

<TextView
android:id="@+id/popup_assignment_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/edit_assignment_label"
android:layout_below="@id/popup_name_container"
android:layout_marginTop="20dp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
android:layout_below="@id/popup_assignment_label"
android:gravity="bottom"
>

<android.support.v7.widget.RecyclerView
android:id="@+id/popup_assignment_recycler"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"/>


<Button
android:id="@+id/btn_1"
android:text="@string/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/popup_assignment_recycler"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="18dp"
/>
<Button
android:id="@+id/btn_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_1"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="9dp"
/>
</LinearLayout>

</RelativeLayout>


I'm setting visibility with



Button mBtn1 = findViewById(R.id.btn_1);
mBtn1.setVisibility(View.VISIBLE);
Button mBtn2 = findViewById(R.id.btn_2);
mBtn2.setVisibility(View.VISIBLE);


I've also tried defining the RelativeLayout's visibility as INVISIBLE in the xml, still no luck.



Is it possible to just show the buttons? I'm stumped, so any help is appreciated!










share|improve this question













I have a RelativeLayout which contains a LinearLayout containing 2 buttons. I would like to make those buttons visible without making the whole RelativeLayout or LinearLayout visible. While debugging, the button's getVisibility reports visible and getLocationOnScreen returns the correct placement but I can't see them. Here is my xml



<RelativeLayout
android:id="@+id/edit_div_element"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:padding="20dp"
android:background="@drawable/full_popup_element"
android:layout_alignParentBottom="true"
android:visibility="gone"
android:layout_centerVertical="true"
android:clickable="false">

<ImageView
android:id="@+id/close_edit"
android:src="@drawable/view_edge_promotion_close_icon"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="@color/uniform_style_blue"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="-10dp"/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/popup_name_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/close_edit"
android:orientation="horizontal" >

<TextView
android:id="@+id/popup_name_label"
android:text="@string/popup_name_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textStyle="bold"
android:textSize="@dimen/font_size_fixed_16" />

<EditText
android:id="@+id/popup_name"
android:hint=""
android:layout_width="170dp"
android:layout_height="wrap_content"
android:inputType="textCapWords"
android:singleLine="true"
android:textSize="18sp"
android:layout_marginLeft="15dp"
android:paddingBottom="2dp"
android:paddingLeft="@dimen/marginSmall" />

</LinearLayout>

<TextView
android:id="@+id/popup_assignment_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/edit_assignment_label"
android:layout_below="@id/popup_name_container"
android:layout_marginTop="20dp"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:orientation="horizontal"
android:layout_below="@id/popup_assignment_label"
android:gravity="bottom"
>

<android.support.v7.widget.RecyclerView
android:id="@+id/popup_assignment_recycler"
android:layout_width="180dp"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"/>


<Button
android:id="@+id/btn_1"
android:text="@string/clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/popup_assignment_recycler"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="18dp"
/>
<Button
android:id="@+id/btn_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/btn_1"
android:layout_alignParentRight="true"
android:gravity="bottom"
android:padding="6dp"
android:maxLines="1"
android:background="@color/uniform_style_blue"
android:textColor="#FFFFFF"
android:layout_marginLeft="9dp"
/>
</LinearLayout>

</RelativeLayout>


I'm setting visibility with



Button mBtn1 = findViewById(R.id.btn_1);
mBtn1.setVisibility(View.VISIBLE);
Button mBtn2 = findViewById(R.id.btn_2);
mBtn2.setVisibility(View.VISIBLE);


I've also tried defining the RelativeLayout's visibility as INVISIBLE in the xml, still no luck.



Is it possible to just show the buttons? I'm stumped, so any help is appreciated!







java android xml view visibility






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 at 19:45









Coleen

478




478








  • 2




    It it not possible to have an invisible parent ViewGroup with a visible child View. So you need to redesign your layout or (if you leave it the way it is) you'll have to individually toggle the visibility of the ImageView, the RecyclerView, the popup_assignment_label TextView and the LinearLayout containing the EditText
    – 0X0nosugar
    Nov 19 at 19:56










  • Bummer, but great to know, thanks! Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:06






  • 1




    The height of the RelativeLayout will vary e.g. with the number and/ or size of items in the RecyclerView, so the position of the Buttons (which seems to be aligned to the bottom line of the RecyclerView) will have to vary as well (else you can simply set a top margin for the buttons). You can try to keep track of changes in the size of the RelativeLayout and each time set the Button position accordingly but IMO this is much more trouble than simply toggling the visiblility of six different Views as required by your app's business logic.
    – 0X0nosugar
    Nov 19 at 20:20










  • I see. My recyclerview is horizontal and has a set width, so I thought that may be straightforward. My concern with toggling visibility is, won't all of those elements show up, even if for a brief moment? To be clear, you're suggesting, a call to relativelayout.setVisibility(VISIBLE) and then toggling all of its child views to GONE? Again, thanks for the help - I've been stuck on this for too long!
    – Coleen
    Nov 19 at 20:35






  • 1




    If you're talking about setting all the child Views to GONE I'm wondering where the buttons really should show up. (Until now, I thought you wanted them to have a right margin of 180 dp and an y position dpending on the RecyclerView.) Maybe a picture would help to clarify what you're trying to achieve?
    – 0X0nosugar
    Nov 19 at 20:41














  • 2




    It it not possible to have an invisible parent ViewGroup with a visible child View. So you need to redesign your layout or (if you leave it the way it is) you'll have to individually toggle the visibility of the ImageView, the RecyclerView, the popup_assignment_label TextView and the LinearLayout containing the EditText
    – 0X0nosugar
    Nov 19 at 19:56










  • Bummer, but great to know, thanks! Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:06






  • 1




    The height of the RelativeLayout will vary e.g. with the number and/ or size of items in the RecyclerView, so the position of the Buttons (which seems to be aligned to the bottom line of the RecyclerView) will have to vary as well (else you can simply set a top margin for the buttons). You can try to keep track of changes in the size of the RelativeLayout and each time set the Button position accordingly but IMO this is much more trouble than simply toggling the visiblility of six different Views as required by your app's business logic.
    – 0X0nosugar
    Nov 19 at 20:20










  • I see. My recyclerview is horizontal and has a set width, so I thought that may be straightforward. My concern with toggling visibility is, won't all of those elements show up, even if for a brief moment? To be clear, you're suggesting, a call to relativelayout.setVisibility(VISIBLE) and then toggling all of its child views to GONE? Again, thanks for the help - I've been stuck on this for too long!
    – Coleen
    Nov 19 at 20:35






  • 1




    If you're talking about setting all the child Views to GONE I'm wondering where the buttons really should show up. (Until now, I thought you wanted them to have a right margin of 180 dp and an y position dpending on the RecyclerView.) Maybe a picture would help to clarify what you're trying to achieve?
    – 0X0nosugar
    Nov 19 at 20:41








2




2




It it not possible to have an invisible parent ViewGroup with a visible child View. So you need to redesign your layout or (if you leave it the way it is) you'll have to individually toggle the visibility of the ImageView, the RecyclerView, the popup_assignment_label TextView and the LinearLayout containing the EditText
– 0X0nosugar
Nov 19 at 19:56




It it not possible to have an invisible parent ViewGroup with a visible child View. So you need to redesign your layout or (if you leave it the way it is) you'll have to individually toggle the visibility of the ImageView, the RecyclerView, the popup_assignment_label TextView and the LinearLayout containing the EditText
– 0X0nosugar
Nov 19 at 19:56












Bummer, but great to know, thanks! Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
– Coleen
Nov 19 at 20:06




Bummer, but great to know, thanks! Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
– Coleen
Nov 19 at 20:06




1




1




The height of the RelativeLayout will vary e.g. with the number and/ or size of items in the RecyclerView, so the position of the Buttons (which seems to be aligned to the bottom line of the RecyclerView) will have to vary as well (else you can simply set a top margin for the buttons). You can try to keep track of changes in the size of the RelativeLayout and each time set the Button position accordingly but IMO this is much more trouble than simply toggling the visiblility of six different Views as required by your app's business logic.
– 0X0nosugar
Nov 19 at 20:20




The height of the RelativeLayout will vary e.g. with the number and/ or size of items in the RecyclerView, so the position of the Buttons (which seems to be aligned to the bottom line of the RecyclerView) will have to vary as well (else you can simply set a top margin for the buttons). You can try to keep track of changes in the size of the RelativeLayout and each time set the Button position accordingly but IMO this is much more trouble than simply toggling the visiblility of six different Views as required by your app's business logic.
– 0X0nosugar
Nov 19 at 20:20












I see. My recyclerview is horizontal and has a set width, so I thought that may be straightforward. My concern with toggling visibility is, won't all of those elements show up, even if for a brief moment? To be clear, you're suggesting, a call to relativelayout.setVisibility(VISIBLE) and then toggling all of its child views to GONE? Again, thanks for the help - I've been stuck on this for too long!
– Coleen
Nov 19 at 20:35




I see. My recyclerview is horizontal and has a set width, so I thought that may be straightforward. My concern with toggling visibility is, won't all of those elements show up, even if for a brief moment? To be clear, you're suggesting, a call to relativelayout.setVisibility(VISIBLE) and then toggling all of its child views to GONE? Again, thanks for the help - I've been stuck on this for too long!
– Coleen
Nov 19 at 20:35




1




1




If you're talking about setting all the child Views to GONE I'm wondering where the buttons really should show up. (Until now, I thought you wanted them to have a right margin of 180 dp and an y position dpending on the RecyclerView.) Maybe a picture would help to clarify what you're trying to achieve?
– 0X0nosugar
Nov 19 at 20:41




If you're talking about setting all the child Views to GONE I'm wondering where the buttons really should show up. (Until now, I thought you wanted them to have a right margin of 180 dp and an y position dpending on the RecyclerView.) Maybe a picture would help to clarify what you're trying to achieve?
– 0X0nosugar
Nov 19 at 20:41












1 Answer
1






active

oldest

votes

















up vote
1
down vote













You have buttons placed inside the layout. If the whole parent is invisible, all the child views are invisible too. If you want to show only buttons, you have to make your relative layout visible, your linear layout visible, and then make your buttons visible. You can also hide all other content of your layout (make invisible) if you do not wanna show it.



Consider parent-child views as boxes. Your buttons - are small boxes, which are placed inside of other, bigger box, which is parent, linear layout. You cannot open small boxes without opening the large (parent) box first.






share|improve this answer





















  • Thanks, I got as much from 0x0nosugar's comment. Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:10











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381615%2fmake-visible-single-view-in-relativelayout%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote













You have buttons placed inside the layout. If the whole parent is invisible, all the child views are invisible too. If you want to show only buttons, you have to make your relative layout visible, your linear layout visible, and then make your buttons visible. You can also hide all other content of your layout (make invisible) if you do not wanna show it.



Consider parent-child views as boxes. Your buttons - are small boxes, which are placed inside of other, bigger box, which is parent, linear layout. You cannot open small boxes without opening the large (parent) box first.






share|improve this answer





















  • Thanks, I got as much from 0x0nosugar's comment. Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:10















up vote
1
down vote













You have buttons placed inside the layout. If the whole parent is invisible, all the child views are invisible too. If you want to show only buttons, you have to make your relative layout visible, your linear layout visible, and then make your buttons visible. You can also hide all other content of your layout (make invisible) if you do not wanna show it.



Consider parent-child views as boxes. Your buttons - are small boxes, which are placed inside of other, bigger box, which is parent, linear layout. You cannot open small boxes without opening the large (parent) box first.






share|improve this answer





















  • Thanks, I got as much from 0x0nosugar's comment. Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:10













up vote
1
down vote










up vote
1
down vote









You have buttons placed inside the layout. If the whole parent is invisible, all the child views are invisible too. If you want to show only buttons, you have to make your relative layout visible, your linear layout visible, and then make your buttons visible. You can also hide all other content of your layout (make invisible) if you do not wanna show it.



Consider parent-child views as boxes. Your buttons - are small boxes, which are placed inside of other, bigger box, which is parent, linear layout. You cannot open small boxes without opening the large (parent) box first.






share|improve this answer












You have buttons placed inside the layout. If the whole parent is invisible, all the child views are invisible too. If you want to show only buttons, you have to make your relative layout visible, your linear layout visible, and then make your buttons visible. You can also hide all other content of your layout (make invisible) if you do not wanna show it.



Consider parent-child views as boxes. Your buttons - are small boxes, which are placed inside of other, bigger box, which is parent, linear layout. You cannot open small boxes without opening the large (parent) box first.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 19 at 20:07









Hanna

614




614












  • Thanks, I got as much from 0x0nosugar's comment. Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:10


















  • Thanks, I got as much from 0x0nosugar's comment. Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
    – Coleen
    Nov 19 at 20:10
















Thanks, I got as much from 0x0nosugar's comment. Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
– Coleen
Nov 19 at 20:10




Thanks, I got as much from 0x0nosugar's comment. Is it possible to have the button views outside of the layout, and put them at a fixed position on the screen relative to the relativelayout they're in now?
– Coleen
Nov 19 at 20:10


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381615%2fmake-visible-single-view-in-relativelayout%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paul Cézanne

UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

Angular material date-picker (MatDatepicker) auto completes the date on focus out