create Vertical Line as a View - Android User Interface

Android examples for User Interface:View

Description

create Vertical Line as a View

Demo Code


//package com.java2s;

import android.content.Context;

import android.view.View;

import android.widget.TableRow;

public class Main {
    /**/*  w  w w .j  a v  a 2s  . c  o m*/
     * @fn public static View createVerticalLine(Context context,int color)
     * @brief Creates a vertical line of width 1 that goes across the parent.
     * @param context 
     * @param color Numerical representation of color. Use android.graphics.Color.rgb(red,green,blue)
     * @return Created vertical line View Object.
     */

    public static View createVerticalLine(Context context, int color) {
        /// Creating lines http://stackoverflow.com/questions/5092116/how-can-i-add-separating-lines-between-my-tablerows-that-are-created-programmati
        View v_line = new View(context);
        v_line.setLayoutParams(new TableRow.LayoutParams(1,
                TableRow.LayoutParams.MATCH_PARENT));
        v_line.setBackgroundColor(color);
        v_line.setPadding(0, 0, 0, 0);
        return v_line;
    }
}

Related Tutorials