How to give only bottom border to RelativeLayout in Android -
i have created relative layout in requires bottom border. how can that? below relativelayout have used.
i have added view inside relative layout shows @ bottom of screen
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#eaeaea" android:orientation="vertical" > <textview android:id="@+id/auth_lbl_register_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:background="#eaeaea" android:clickable="true" android:ellipsize="none" android:fontfamily="fnb sans" android:gravity="left" android:maxlines="50" android:paddingbottom="10dp" android:paddingright="10dp" android:paddingtop="10dp" android:scrollhorizontally="false" android:text="@string/auth_into" android:textcolor="@color/labelcolor" android:textsize="20sp" /> <relativelayout android:layout_width="fill_parent" android:layout_height="50dp" android:layout_marginleft="5dp" android:layout_marginright="5dp" android:background="@drawable/border" android:orientation="horizontal" > <textview android:id="@+id/cellnum_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:fontfamily="fnb sans" android:text="@string/cell_num_label" android:textcolor="@color/labelcolor" android:textsize="15sp" /> <edittext android:id="@+id/auth_txt_msisdn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centervertical="true" android:layout_marginleft="25dp" android:layout_torightof="@+id/cellnum_text" android:ellipsize="start" android:ems="10" android:gravity="center_horizontal" android:hint="enter cell number" android:inputtype="number" android:singleline="true" android:textsize="15sp" /> </relativelayout> <relativelayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingleft="5sp" android:paddingright="5sp" > <checkbox android:id="@+id/auth_cbx_agree_terms" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_marginbottom="10dp" android:layout_margintop="10dp" android:button="@drawable/check_box" android:clickable="true" android:ellipsize="none" android:fontfamily="fnb sans" android:gravity="left" android:maxlines="50" android:paddingleft="10dp" android:paddingstart="30dp" android:scrollhorizontally="false" android:text="@string/auth_agree_terms" android:textcolor="@color/labelcolor" android:textsize="20sp" /> </relativelayout> <!-- next --> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview android:id="@+id/auth_cmd_validate" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_weight="0.9" android:background="#f49b00" android:gravity="center" android:paddingleft="0dp" android:text="next" android:textcolor="@color/labelcolor" android:textsize="20dp" android:textstyle="normal" /> <imageview android:layout_width="40dp" android:layout_height="50dp" android:layout_alignparentright="true" android:src="@drawable/next_arrow_white" /> </relativelayout> <!-- end of next --> <textview android:id="@+id/or_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginbottom="5dp" android:layout_margintop="5dp" android:background="#eaeaea" android:clickable="false" android:fontfamily="fnb sans" android:gravity="center" android:padding="10sp" android:text="or" android:textcolor="@color/labelcolor" android:textsize="20sp" /> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview android:id="@+id/auth_cmd_register" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_weight="0.9" android:background="@color/white" android:gravity="center" android:paddingleft="0dp" android:text="register online" android:textcolor="@color/labelcolor" android:textsize="20dp" android:textstyle="normal" /> <imageview android:id="@+id/imgarrowright" android:layout_width="40dp" android:layout_height="50dp" android:layout_alignparentright="true" android:gravity="center" android:src="@drawable/line_arrow" /> <view android:id="@+id/view" android:layout_width="fill_parent" android:layout_height="2dp" android:layout_alignparentbottom="true" android:background="@color/black" /> </relativelayout> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview android:id="@+id/auth_cmd_terms" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_weight="0.9" android:background="#ffffff" android:gravity="center" android:paddingleft="0dp" android:text="terms , condition" android:textcolor="@color/labelcolor" android:textsize="20dp" android:textstyle="normal" /> <imageview android:id="@+id/imgarrowright1" android:layout_width="40dp" android:layout_height="50dp" android:layout_alignparentright="true" android:gravity="center" android:src="@drawable/line_arrow" /> </relativelayout>
you need specify android:layout_height="n"
n height in dp when using android:layout_alignparentbottom="true"
:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <relativelayout android:id="@+id/relativelayoutone" android:layout_width="fill_parent" android:layout_height="200dp"> <!-- bottom border shows --> <view android:layout_alignparentbottom="true" android:layout_height="1dp" android:background="#f00" android:layout_width="fill_parent"/> </relativelayout> <relativelayout android:id="@+id/relativelayouttwo" android:layout_width="fill_parent" android:layout_height="wrap_content"> <textview android:text="text view 1" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </relativelayout> <relativelayout android:id="@+id/relativelayoutthree" android:layout_width="fill_parent" android:layout_height="wrap_content"> <textview android:text="text view 2" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </relativelayout> </linearlayout>
Comments
Post a Comment