title: How to give priority to layout which should be at top?
body: <p>In the building, tic-tac-toe grid layout occupies the upper layer and Linearlayout occupies the lower layer just below the grid layout. where the Linear layout should appear if any player wins the match. In linear layout the player who wins and a button to set the game to the starting position. So initially I set it to invisible when the game ends linear layout comes back side of grid layout. How can I make the Linear Layout on top of grid layout? </p>
  
  <p>MainActivity.java</p>
  
  <pre><code>package com.example.achyu.tictactao;
  
  import android.graphics.Color;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class MainActivity extends AppCompatActivity {
  
  //0=yellow  1=red
  int currentPlayer=0;
  
  int[] isItDone={2, 2, 2, 2, 2, 2, 2, 2, 2};
  
  //2=yellow  1=red
  int[] whoWon=new int[9];
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  }
  
  public void currentCounter(View view){
  
      ImageView counter= (ImageView) view;
  
      int tap=Integer.parseInt(counter.getTag().toString());
  
      if(isItDone[tap]==2){
  
          counter.setTranslationY(-1000f);
          if(currentPlayer==0){
  
              counter.setImageResource(R.drawable.yellow);
              currentPlayer=1;
              whoWon[tap]=2;
  
  
              if((whoWon[0]==2&amp;&amp;whoWon[1]==2&amp;&amp;whoWon[2]==2)||(whoWon[3]==2&amp;&amp;whoWon[4]==2&amp;&amp;whoWon[5]==2)||
                      (whoWon[6]==2&amp;&amp;whoWon[7]==2&amp;&amp;whoWon[8]==2)||(whoWon[0]==2&amp;&amp;whoWon[3]==2&amp;&amp;whoWon[6]==2)||
                      (whoWon[1]==2&amp;&amp;whoWon[4]==2&amp;&amp;whoWon[7]==2)||(whoWon[2]==2&amp;&amp;whoWon[5]==2&amp;&amp;whoWon[8]==2)||
                      (whoWon[0]==2&amp;&amp;whoWon[4]==2&amp;&amp;whoWon[8]==2)||(whoWon[2]==2&amp;&amp;whoWon[4]==2&amp;&amp;whoWon[6]==2))
              {
                  Toast.makeText(this,"Yellow Has Won",Toast.LENGTH_LONG).show();
  
                  LinearLayout layout = (LinearLayout)findViewById(R.id.linearlayout);
                  layout.setVisibility(View.VISIBLE);
                  TextView winnerText= (TextView) findViewById(R.id.winner);
                  winnerText.setText("Yello Won");
                  winnerText.setTextColor(Color.WHITE);
  
              }
          }
          else
          {
              counter.setImageResource(R.drawable.red);
              currentPlayer=0;
  
              whoWon[tap]=1;
  
              if((whoWon[0]==1&amp;&amp;whoWon[1]==1&amp;&amp;whoWon[2]==1)||(whoWon[3]==1&amp;&amp;whoWon[4]==1&amp;&amp;whoWon[5]==1)||
                      (whoWon[6]==1&amp;&amp;whoWon[7]==1&amp;&amp;whoWon[8]==1)||(whoWon[0]==1&amp;&amp;whoWon[3]==1&amp;&amp;whoWon[6]==1)||
                      (whoWon[1]==1&amp;&amp;whoWon[4]==1&amp;&amp;whoWon[7]==1)||(whoWon[2]==1&amp;&amp;whoWon[5]==1&amp;&amp;whoWon[8]==1)||
                      (whoWon[0]==1&amp;&amp;whoWon[4]==1&amp;&amp;whoWon[8]==1)||(whoWon[2]==1&amp;&amp;whoWon[4]==1&amp;&amp;whoWon[6]==1))
              {
                  Toast.makeText(this,"Red Has Won",Toast.LENGTH_LONG).show();
  
                  LinearLayout layout = (LinearLayout)findViewById(R.id.linearlayout);
                  layout.setVisibility(View.VISIBLE);
                  TextView winnerText= (TextView) findViewById(R.id.winner);
                  winnerText.setText("Red Won");
                  winnerText.setTextColor(Color.WHITE);
              }
          }
          counter.animate().translationYBy(1000f).setDuration(300);
          isItDone[tap]=3;
  
  
      }
  }
  }
  </code></pre>
  
  <p>XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout         
       xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:app="http://schemas.android.com/apk/res-auto"
       xmlns:tools="http://schemas.android.com/tools"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       tools:context="com.example.achyu.tictactao.MainActivity"&gt;
  
  &lt;RelativeLayout
      android:layout_width="395dp"
      android:layout_height="587dp"
      tools:layout_editor_absoluteX="8dp"
      tools:layout_editor_absoluteY="8dp"&gt;
  
      &lt;LinearLayout
          android:id="@+id/linearlayout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:background="@drawable/orange"
          android:orientation="vertical"
          android:padding="60dp"
          android:visibility="invisible"&gt;
  
          &lt;TextView
              android:id="@+id/winner"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:padding="10dp"
              android:text="TextView"
              android:textSize="40sp"
              tools:textColor="#ffffff" /&gt;
  
          &lt;Button
              android:id="@+id/playagain"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:text="Button" /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;GridLayout
          android:layout_width="360dp"
          android:layout_height="360dp"
          android:background="@drawable/board"
          android:columnCount="3"
          android:rowCount="3"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"&gt;
  
          &lt;ImageView
              android:id="@+id/imageView0"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="0"
              android:layout_marginLeft="10dp"
              android:tag="0"
              android:layout_row="0"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView1"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="1"
              android:layout_marginLeft="20dp"
              android:tag="1"
              android:layout_row="0"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView2"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="2"
              android:layout_marginLeft="25dp"
              android:tag="2"
              android:layout_row="0"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView3"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="0"
              android:layout_marginLeft="10dp"
              android:layout_marginTop="30dp"
              android:tag="3"
              android:layout_row="1"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView4"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="1"
              android:layout_marginLeft="20dp"
              android:layout_marginTop="30dp"
              android:tag="4"
              android:layout_row="1"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView5"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="2"
              android:layout_marginLeft="25dp"
              android:layout_marginTop="30dp"
              android:tag="5"
              android:layout_row="1"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView6"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="0"
              android:layout_marginLeft="10dp"
              android:layout_marginTop="30dp"
              android:tag="6"
              android:layout_row="2"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView7"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="1"
              android:layout_marginLeft="20dp"
              android:layout_marginTop="30dp"
              android:tag="7"
              android:layout_row="2"
              android:onClick="currentCounter" /&gt;
  
          &lt;ImageView
              android:id="@+id/imageView8"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:layout_column="2"
              android:layout_marginLeft="25dp"
              android:layout_marginTop="30dp"
              android:tag="8"
              android:layout_row="2"
              android:onClick="currentCounter" /&gt;
      &lt;/GridLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>