How to create Vertical and Horizontal line in XML in android

Vertical Line in android


<?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:layout_gravity="center"   
 android:background="@color/colorBlack">

    <View        android:layout_width="2dp"     
   android:layout_height="match_parent"       
 android:layout_marginBottom="50dp"      
  android:layout_marginLeft="200dp"      
  android:layout_marginTop="50dp"
android:background="@color/colorWhite" />
</LinearLayout>


Screenshot



Horizontal Line in android


<?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="@color/colorBlack">


    <View    
    android:layout_width="match_parent"
        android:layout_height="2dp"
        android:layout_gravity="center"
        android:layout_marginLeft="10dp" 
        android:layout_marginRight="10dp"
        android:background="@color/colorWhite" />
</LinearLayout>

Screenshot




0 comments: