Here is my Code
<RelativeLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/black_strip_top"
android:layout_width="wrap_content"
android:layout_above="@id/left_strip"
android:layout_height="2dp"
android:background="@color/black" />
<ImageView
android:id="@+id/black_strip_below"
android:layout_width="wrap_content"
android:layout_below="@id/left_strip"
android:layout_height="2dp"
android:background="@color/black" />
<ImageView
android:id="@+id/left_strip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/left_strip" />
<ImageView
android:id="@+id/right_strip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/image"
android:src="@drawable/right_strip" />
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitXY" />
</RelativeLayout>
I want to have a black strip of 2dp at top and below of the image. But i am not able to get it. Please help me out.
Your
@+id/black_strip_topis above@+id/imagebut that not means that@+id/imagewill be below@+id/black_strip_top. It looks a riddle but is basically your problem. This is a possible solution:Other option could be to use a
GridViewinstead ofRelativeLayout