Add border to only bottom side in relativelayout android

Set border to only down side of relative layout using view simple example tutorial through xml.

Bottom side border are used to display a unique underline on whole relative layout. Bottom side border makes your application feels like that whole app is based upon border. So here is the complete step by step tutorial for Add border to only bottom side in relativelayout android.

android-project-download-code-button

How to Add border to only bottom side in relativelayout android.

Code for MainActivity.java file.

package com.bottomborder_android_examples.com;
import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 }
}

Code for activity_main.xml layout file.

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 tools:context="com.bottomborder_android_examples.com.MainActivity"
 >

<!-- VIEW IS USED TO DISPLAY BOTTOM BORDER -->
 <View
 android:id="@+id/view1"
 android:layout_width="fill_parent"
 android:layout_height="3dp"
 android:layout_alignParentBottom="true"
 android:layout_centerHorizontal="true"
 android:background="#0f03fe" />

 <TextView
 android:id="@+id/textView1"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_centerHorizontal="true"
 android:layout_centerVertical="true"
 android:text="Android Activity with bottom border in RelativeLayout."
 android:textAppearance="?android:attr/textAppearanceLarge"
 android:gravity="center" />

</RelativeLayout>

Screenshot:

Add border to only bottom side in relativelayout android

Click Here to download Add border to only bottom side in relativelayout android project.

Leave a Reply

Your email address will not be published. Required fields are marked *