title: My Spinner View has an elevation shadow acquired from its parent
body: <p>I have a LinearLayout with two children: a TextView and a Spinner. The LinearLayout, which acquired a theme I defined in the style.xml file, has an elevation value to create the shadow. However, for some reason, the Spinner is getting a shadow as well. It seems to be acquiring it from its parent. If I remove the android:theme property from the LinearLayout parent, the shadow on both the layout and the Spinner go away.</p>
  
  <p>What is going on here? I would like my Spinner to NOT have a shadow.</p>
  
  <p>Also, if I make a custom theme for the Spinner and set the elevation to 0dp, that will get rid of the shadow, but the Spinner runs into other layout problems. I know I'm doing something wrong here...</p>
  
  <p>Here is my code.</p>
  
  <p>Layout Section:</p>
  
  <pre><code>        &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_marginBottom="5dp"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp"
              android:layout_marginTop="5dp"
              android:background="@drawable/section_background"
              android:orientation="vertical"
              android:theme="@style/AppTheme.Section"&gt;
  
              &lt;TextView
                  android:id="@+id/titleCalendar"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="10dp"
                  android:layout_marginLeft="10dp"
                  android:layout_marginTop="5dp"
                  android:text="Calendar"
                  android:textAppearance="?android:attr/textAppearanceMedium"
                  android:textStyle="bold" /&gt;
  
              &lt;Spinner
                  android:id="@+id/calendarSpinner"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="10dp"
                  android:layout_marginRight="20dp"
                  android:layout_marginLeft="20dp"/&gt;
          &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Theme of the LinearLayout (@style/AppTheme.Section):</p>
  
  <pre><code>        &lt;style name="AppTheme.Section"&gt;
              &lt;item name="android:elevation"&gt;6dp&lt;/item&gt;
          &lt;/style&gt;
  </code></pre>
  
  <p>Java code to fill the Spinner with options:</p>
  
  <pre><code>     String[] spinnerItems = new String[]{
              "Hello",
              "I Love You",
              "This is a Test"
      };
  
      calendarSpinner = (Spinner) findViewById(R.id.calendarSpinner);
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, spinnerItems);
      adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item );
      calendarSpinner.setAdapter(adapter);
  </code></pre>
  
  <p>Here is how it looks on the device:</p>
  
  <p><img src="https://i.stack.imgur.com/GdFoQ.png" alt="enter image description here"></p>
  
  <p>Now, if I add a custom theme to the Spinner...</p>
  
  <pre><code>&lt;Spinner
       android:id="@+id/calendarSpinner"
       android:layout_width="match_parent"
       android:layout_height="wrap_content"
       android:layout_marginBottom="10dp"
       android:layout_marginRight="20dp"
       android:layout_marginLeft="20dp"
       android:theme="@style/SpinnerTheme"/&gt;
  </code></pre>
  
  <p>Style:</p>
  
  <pre><code> &lt;style name="SpinnerTheme" parent="AppTheme.SpinnerBase"&gt;
        &lt;item name="android:elevation"&gt;0dp&lt;/item&gt;
   &lt;/style&gt;
  </code></pre>
  
  <p>Style Parent (AppTheme.SpinnerBase):</p>
  
  <pre><code> &lt;style name="AppTheme.SpinnerBase" parent="Widget.AppCompat.Spinner.Underlined"&gt;
   &lt;/style&gt;
  </code></pre>
  
  <p>Here is what I end up with:</p>
  
  <p><img src="https://i.stack.imgur.com/dOebc.png" alt="enter image description here"></p>
  
  <hr>
  
  <p><img src="https://i.stack.imgur.com/HmERr.png" alt="enter image description here"></p>
  
  <p>The Spinner dropdown has the line and a spinner arrow on the right!</p>