Android examples for User Interface:View
create Horizontal Line and return a View
//package com.java2s; import android.content.Context; import android.view.View; import android.widget.TableRow; public class Main { /**/*www . j a v a 2 s .c om*/ * @fn public static View createHorizontalLine(Context context,int color) * @brief Creates a horizontal line of height 1 that goes across the parent. * @param context * @param color Numerical representation of color. Use android.graphics.Color.rgb(red,green,blue) * @return Created horizontal line View Object. */ public static View createHorizontalLine(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 h_line = new View(context); h_line.setLayoutParams(new TableRow.LayoutParams( TableRow.LayoutParams.MATCH_PARENT, 1)); h_line.setBackgroundColor(color); h_line.setPadding(0, 0, 0, 0); return h_line; } }