Note that there are some explanatory texts on larger screens.

plurals
  1. POSquare shaped layout border with round inside edges
    primarykey
    data
    text
    <p>I’m attempting to create a layout border with corners that are square on the outside and round on the inside. I’ve gathered that I need to create an xml drawable definition composed of two shapes: one with a stroke width and corner radius and another with a stroke width only:</p> <p>drawables/</p> <p>round_border.xml</p> <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;stroke android:width="4dp" android:color="#FF000000" /&gt; &lt;padding android:left="7dp" android:top="7dp" android:right="7dp" android:bottom="7dp" /&gt; &lt;corners android:radius="4dp" /&gt; &lt;solid android:color="#FFC0C0C0" /&gt; &lt;/shape&gt; </code></pre> <p>square_border.xml</p> <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;stroke android:width="2dp" android:color="#FF000000" /&gt; &lt;solid android:color="#FFC0C0C0" /&gt; &lt;/shape&gt; </code></pre> <p>Each of these works independantly as a border when appliedby itself like so:</p> <p>android:background="@drawable/round_border" but when they either or both are added to an item-list drawable like so:</p> <p>composite_border.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;layer-list&gt; &lt;item android:drawable="@drawable/round_border"/&gt; &lt;!-- &lt;item android:drawable="@drawable/square_border"/&gt; --&gt; &lt;/layer-list&gt; &lt;/shape&gt; </code></pre> <p>and:</p> <p>android:background="@drawable/composite_border"</p> <p>The layout's background is completely black instead of just a black border - anyone know how to make the layer list work for this task?</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.
 

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