5

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

4

1 回答 1

4

这是一个中风,所以它围绕形状。这意味着它通过两边的线,所以它需要两倍的笔画宽度。

您可以<size>在形状中设置标签并将其放在 1dp 和<solid android:color="">颜色上

于 2013-09-08T09:30:54.380 回答