Note that there are some explanatory texts on larger screens.

plurals
  1. POChild Layout visibility gone on another child layout click event
    primarykey
    data
    text
    <p>My parent <code>Linearlayout1</code> contains two child Frame Layouts: <code>FrameLayout1</code> and <code>FrameLayout2</code>.</p> <p>The <code>FrameLayout1</code> is on top of <code>FrameLayout2</code> but only covers the half of <code>FrameLayout2</code>.</p> <p>I replaced <code>FrameLayout1</code> with some <code>fragment1</code> and also replaced <code>FrameLayout2</code> with some <code>fragment2</code>.</p> <p>Now, when I click on <code>FrameLayout2</code>, the <code>FrameLayout1</code> should get Invisible. But this is not happening.</p> <p>I tried the following to do so:</p> <p><strong>userDetails.java</strong></p> <pre><code> @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.inflate(R.layout.userDetails, container, false); topLayout = (LinearLayout) getActivity().findViewById(R.id.FrameLayout1); bottomLayout = (LinearLayout) getActivity().findViewById(R.id.FrameLayout2); view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { topLayout.setVisibility(View.GONE); } }); } </code></pre> <p>I also found that onClick listener of view is not getting called on its click.</p> <p>UPDATE:</p> <p><strong>activity_main.xml</strong>:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;LinearLayout android:id="@+id/FrameLayout1" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" /&gt; &lt;LinearLayout android:id="@+id/FrameLayout2" android:layout_weight="2" android:layout_width="0dp" android:layout_height="match_parent" /&gt; &lt;/FrameLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload