Android examples for User Interface:ImageView
add Line View via ImageView
//package com.java2s; import android.content.Context; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.widget.ImageView; import android.widget.LinearLayout; public class Main { public static void addLineView(ViewGroup holder, int color) { Context context = holder.getContext(); ImageView lineView = new ImageView(context); lineView.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT, 1)); lineView.setBackgroundColor(color); LinearLayout marginView = new LinearLayout(context); marginView.setPadding(0, 6, 0, 6); marginView.setLayoutParams(new LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); marginView.addView(lineView);/*from ww w.j av a 2 s .c o m*/ holder.addView(marginView); } }