I have the following drawable shape:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line" >
<stroke
android:width="1dp"
android:color="#e0e0e0" />
</shape>
And use this with this image:
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="8dp"
android:src="@drawable/line" />
When I set android:layout_height
to 1dp, the shape is not visible. If the android:layout_height
is set to 2dp, the shape is visible.
Why do I have to use a height of 2dp?
Ralph
It's a stroke, so it goes around the shape. Meaning it passes the line on both sides, so it will need twice the width of the stroke.
You could just set
<size>
tag in your shape and put that on 1dp and<solid android:color="">
for the color