Note that there are some explanatory texts on larger screens.

plurals
  1. POmoving Layouts in LinearLayout
    primarykey
    data
    text
    <p>I'm trying to change the position of a Relative Layout in a vertical Linear Layout. The Relative Layout should first be invisible/gone but when I press button1 it should be between button1 and button2. My container_input contains some seekBars and and textViews which I use to change some values.</p> <p>I tried to archive this by doing this: </p> <p>XML: </p> <pre class="lang-html prettyprint-override"><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/Layout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:orientation="vertical" android:padding="5dp" &gt; &lt;Button android:id="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button"/&gt; &lt;Button android:id="@+id/button2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button"/&gt; &lt;Button android:id="@+id/button3" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Button"/&gt; &lt;include android:id="@+id/container_input_ref" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="@layout/container_input" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>Java Code: </p> <pre class="lang-html prettyprint-override"><code>int selected = 0; public void onClick(final View view) { if(view == button1) { selected = 1; container_input_ref.setVisibility(view.VISIBLE); container_input_ref.setY(button1.getBottom()); button2.setY(container_input_ref.getBottom()); button3.setY(button2.getBottom()); } if(view == button2) { selected = 2; container_input_ref.setVisibility(view.VISIBLE); container_input_ref.setY(button2.getBottom()); button3.setY(container_input_ref.getBottom()); } etc. ... } </code></pre> <p>But if I press button1 the Layout is not like that what i was supposed to get.</p> <p>Does anyone have an idea how to move layouts/buttons OnClick?</p> <p>Greetings</p>
    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.
    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