Reputation: 420
I need a border at the bottom, left and right of TextView, but for the left and right border only custom size of actual textview height, not the whole. Looks like this:
Could anyone explain how to implement it? At current moment I draw border at bottom, left and right using this code
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/white" />
</shape>
</item>
<item
android:bottom="1px"
android:left="1px"
android:right="1px"
android:top="-2dp">
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/grey_20" />
<solid android:color="@null" />
</shape>
</item>
Upvotes: 0
Views: 613
Reputation: 420
Find a solution, this works for me
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<solid android:color="@color/line_grey" />
</shape>
</item>
<item
android:bottom="1dp"
android:left="1dp"
android:right="1dp">
<shape>
<solid android:color="@color/white" />
</shape>
</item>
<item android:bottom="8.0dp">
<shape>
<solid android:color="@color/white" />
</shape>
</item>
Upvotes: 0
Reputation: 802
You can directly give the padding to the layout in which you put the image and give background to the layout you will get border around the corner. And you also got custom border around the image.
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimaryDark"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="20dp"
android:paddingRight="10dp"
android:paddingTop="20dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff" />
I am giving background to a image you can give image source.
Upvotes: 1