title: How can I make a triangle drawable on the top left of my view?
body: <p>I have created this drawable:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android" &gt;
      &lt;item  &gt;
          &lt;rotate
              android:fromDegrees="45"
              android:toDegrees="10"
              android:pivotX="100%"
              android:pivotY="-0%" &gt;
              &lt;shape
                  android:shape="rectangle"   &gt;
                  &lt;solid
                      android:color="@color/color_primary"  /&gt;
              &lt;/shape&gt;
  
          &lt;/rotate&gt;
      &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>On the preview it looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/WGPaZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WGPaZ.png" alt="enter image description here"></a></p>
  
  <p>And I have put it into this <code>View</code>:</p>
  
  <pre><code>        &lt;View
          android:id="@+id/my_view"
          android:layout_width="32dp"
          android:layout_height="32dp"
          android:background="@drawable/triangle"
          app:layout_constraintLeft_toLeftOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          /&gt;
  </code></pre>
  
  <p>And this <code>View</code> looks like this on the preview (and on the phone):</p>
  
  <p><a href="https://i.stack.imgur.com/p8crS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p8crS.png" alt="enter image description here"></a></p>
  
  <p>Why doesn't the <code>View</code> just show the triangle on the corner like on the triangle preview? Also, I should mention that I want it to fill half of the <code>View</code> square, basically go from the the top right corner to the bottom left corner. </p>
  
  <p>Thanks. </p>
  
  <p>Edit: I was given a suggestion to use:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list xmlns:android="http://schemas.android.com/apk/res/android" &gt;
      &lt;item  &gt;
          &lt;rotate
              android:fromDegrees="45"
              android:toDegrees="-135"
              android:pivotX="90%"
              android:pivotY="-45%" &gt;
              &lt;shape
                  android:shape="rectangle"   &gt;
                  &lt;solid
                      android:color="@color/color_primary"  /&gt;
              &lt;/shape&gt;
  
          &lt;/rotate&gt;
      &lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>And that does produce a corner triangle but it doesn't fill half of the <code>View</code> square. This is what it does:
  <a href="https://i.stack.imgur.com/3zbfR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3zbfR.png" alt="enter image description here"></a></p>