Code example for ImageView

Methods: setLayoutParamssetPaddingsetImageBitmapsetScaleType

0
	// Create the view for each user status 
	// [FIXME] Should be put as an XML file (possible?) 
	 
	private View makeUserStatusView(Context context, TwitterEntry entry) {
 
    	ImageView iv = new ImageView(context);
    	Bitmap photo = BitmapCache.getInstance().get(entry.getUser().getProfileImageURL());
 
    	iv.setImageBitmap(photo);
    	iv.setScaleType(ScaleType.CENTER);
    	iv.setPadding(0, 4, 4, 0);
    	iv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	 
    	TextView tv = new TextView(context);
    	tv.setText(entry.getUser().getName() + ": " + entry.getText());
    	tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
	 
    	LinearLayout layout = new LinearLayout(context);
    	layout.setOrientation(LinearLayout.HORIZONTAL);
    	layout.setPadding(4, 2, 4, 2);