Code example for TextView

Methods: setHeight, setId, setLayoutParams, setTag

0
     * @param text          The text to display 
     * @param desiredHeight The desired height of the text view 
     * @return The created view. 
     */ 
    public static View text(int position, Context context, String text, int desiredHeight) {
        TextView result = new TextView(context);
        result.setHeight(desiredHeight);
        result.setText(text);
        final ViewGroup.LayoutParams lp = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        result.setLayoutParams(lp);
        result.setId(position);
        result.setTag("text");
        return result;
    } 
     
    /** 
     * Convert an existing text view to display the data at a new position. 
     *  
     * @param convertView Non-null TextView created by {@link #text}