I want to add a bottom border to my textView , something like this :
could you help me to do so ? I don't want to use 9patch png ,is it possible to do so by using xml drawable?
I want to add a bottom border to my textView , something like this :
could you help me to do so ? I don't want to use 9patch png ,is it possible to do so by using xml drawable?
you can do it using layer list:
border.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/WhiteSmoke"/>
<corners android:radius="2dp" />
</shape>
</item>
<item
android:left="2dp"
android:right="2dp"
android:top="5dp"
android:bottom="0dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="2dp" />
</shape>
</item>
Where you can define how thick the border is in android:left,right,..
To use it on text view you must save it into res/drawable and then set the background of your text view to:
android:background:"@drawable/border"
The android:layout_alignParentBottom
attribute has to be declared in an element of the RelativeLayout.
Here is the sample code -
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true">
<ListView ...>
<Button android:id="@+id/btnGetMoreResults"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Get more"
android:layout_alignParentBottom="true" />
</RelativeLayout>
HOpe this helps :)