views:

12

answers:

0

Hi, I am writint a custom adaptor for a ListView.. But have problem setting the Text Right of a Image.. Here is my code..

        LinearLayout.LayoutParams iconParams = new LinearLayout.LayoutParams(25,25);

        //Icon Parameters
        this.actionIcon = new ImageView(context);
        this.actionIcon.setImageResource(R.drawable.vgame_taskbar);
        this.addView(actionIcon, iconParams);

        //Test parameters
      RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.TRUE,RelativeLayout.TRUE); 
        params.addRule(RelativeLayout.RIGHT_OF , this.actionIcon.getId() );

        this.name = new TextView(context);
        this.name.setText("Post " + cp.id.toString());
        this.name.setTextSize(16f);           
        this.name.setTextColor(Color.BLACK);
        this.name.setTypeface(Typeface.DEFAULT_BOLD);                       
        this.addView(this.name, params);

        params.addRule(RelativeLayout.RIGHT_OF , this.actionIcon.getId() );
        params.addRule(RelativeLayout.BELOW , this.name.getId() );


        this.description = new TextView(context);
        this.description.setText(cp.description);
        this.description.setTextSize(16f);
        this.description.setTextColor(Color.GRAY);
        this.addView(this.description, params);

The 3 Views are shown in the list but after each other, not with the Text Right of the Icon.. Can any of you help?

Thanks Kim