Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can nest your shape inside a rotate tag.</p> <pre><code>&lt;rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="90" android:toDegrees="90"&gt; &lt;shape android:shape="line"&gt; &lt;stroke android:width="1dp" android:color="#ff00ff" android:dashWidth="1dp" android:dashGap="2dp" /&gt; &lt;/shape&gt; &lt;/rotate&gt; </code></pre> <p>However, the only problem is the layout params defined in your layout xml will be the dimensions used to draw the original shape. Meaning if you want your line to be 30dp tall, you need to define a layout_width of 30dp in your layout xml. But the final width will also be 30dp in that case, which is likely undesirable for most situations. This essentially means both width and height have to be the same value, the value of your desired length for the line. I couldn't figure out how to fix this.</p> <p>This seems to be the "android way" solution, but unless there's some fix or workaround for the dimensions issue I mention then this likely won't work for most people. What we really need is an orientation attribute in &lt;shape/&gt; or &lt;stroke/&gt;.</p> <p>You can also try referencing another drawable in the rotate tag's attributes, such as:</p> <pre><code>&lt;rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="90" android:toDegrees="90" android:drawable="@drawable/horizontal_line" /&gt; </code></pre> <p>However I haven't tested this and expect it to have the same issues.</p> <p>-- EDIT --</p> <p>Oh, I actually figured out a fix. You can use a negative margin in your layout xml to get rid of the undesired extra space. Such as:</p> <pre><code>&lt;ImageView android:layout_width="35dp" android:layout_height="35dp" android:layout_marginLeft="-15dp" android:layout_marginRight="-15dp" android:src="@drawable/dashed_vertical_line" /&gt; </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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