title: Problem with a Button inside a Custom Dialog (created in RecyclerView Adapter)
body: <p>I have a <code>RecyclerView</code> , in each item there's a (Share) button that prompts a custom dialog which contains a <code>TextView</code> and a <code>Button</code>.
  so, I build the custom dialog inside the <code>Adapter</code> of <code>RecyclerView</code> , everything is fine except for the button's appearance.</p>
  
  <p>it looks like there's a white overlay on top of it and when I click on it, the overlay slightly disappears. </p>
  
  <p>This is what the Button looks like in xml:
  <a href="https://i.stack.imgur.com/75DcZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/75DcZ.png" alt="enter image description here"></a></p>
  
  <p>and here's what I get: 
  <a href="https://i.stack.imgur.com/UCnmQ.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UCnmQ.gif" alt="enter image description here"></a></p>
  
  <p>here's my custom dialog layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:theme="@style/AppTheme"&gt;
  
      &lt;TextView
          android:id="@+id/tv_url"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:autoLink="web"
          android:padding="@dimen/fab_margin"
          android:textSize="8pt"
          /&gt;
  
      &lt;Button
          android:id="@+id/btn_copy"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:text="@string/copy_address"
          android:theme="@style/button"/&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and this is the java code creating the dialog:</p>
  
  <pre><code>AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext());
  LayoutInflater inflater = (LayoutInflater) view.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  builder.setView(inflater.inflate(R.layout.share_dialog, null));
      builder.setTitle(view.getContext().getResources().getString(R.string.share));
  share = builder.create();
  share.show();
  </code></pre>
  
  <p><strong>Note</strong>: I think the problem is related to the Inflater, particularly this line:</p>
  
  <pre><code>LayoutInflater inflater = (LayoutInflater) view.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  </code></pre>
  
  <p>because in MainActivity it works fine when I replace it by this: </p>
  
  <pre><code>LayoutInflater inflater = MainActivity.this.getLayoutInflater();
  </code></pre>
  
  <p>but I can't use it since I can't get Activity from inside the adapter.</p>
  
  <p>I hope my question is clear, I'd appreciate your help.</p>
  
  <p><strong>Edit:</strong> code of <code>@style/button</code></p>
  
  <pre><code>&lt;style name="button" parent="ThemeOverlay.AppCompat.Light"&gt;
          &lt;item name="colorControlHighlight"&gt;@color/colorPrimaryDark&lt;/item&gt;
          &lt;item name="colorButtonNormal"&gt;@color/colorGray&lt;/item&gt;
          &lt;item name="android:textColor"&gt;@color/colorWhite&lt;/item&gt;
          &lt;item name="android:colorAccent"&gt;@color/colorPrimary&lt;/item&gt;
      &lt;/style&gt;
  </code></pre>