Code example for AbsListView.LayoutParams

0
 
    @SuppressWarnings("deprecation") 
	public View getView(int position, View convertView, ViewGroup parent) {
        final Button b;
         
        LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, 150);
         
         
        if (convertView == null) {
            b = new Button(mContext);
            b.setLayoutParams(lp);            
            b.setPadding(12, 12, 12, 12);
            b.setTextSize(20f);      
        } else { 
            b = (Button) convertView;
        } 
         
        final GradientColor gd = Gradients.AllGradients().get(position);
         
        int firstColor = gd.getColorA();
        int secondColor = gd.getColorD();