Android: RelativeLayout.LEFT_OF does not work?
===

another question for which I could not find answer:
I've got a RelativeLayout, that should have a button at its right edge and an ImageButton close to the left. And I do not know how to arrange this.

What I try is:

<code>

        RelativeLayout TopLayout = (RelativeLayout) findViewById(R.id.topLayout);
        TopLayout.removeAllViews();
        TopLayout.setPadding(m_TableRowPadding_px, 8, m_TableRowPadding_px, 4);
    
        RelativeLayout.LayoutParams bParams = new RelativeLayout.LayoutParams(m_Resources
            .getDimensionPixelSize(R.dimen.ButtonWidth), m_DefaultButtonHeight_px);
        bParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        bParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        
        Button itemAddButton = new Button(this);
        itemAddButton.setLayoutParams(bParams);
        itemAddButton.setText(m_Resources.getString(R.string.add_item_button));
        itemAddButton.setOnClickListener(new View.OnClickListener()
        {...});
        
        TopLayout.addView(itemAddButton);
        
        RelativeLayout.LayoutParams ibParams = new RelativeLayout.LayoutParams(MIN_IMG_BUTTON_WIDTH,
            m_DefaultButtonHeight_px);
        ibParams.addRule(RelativeLayout.LEFT_OF, itemAddButton.getId());
        
        ImageButton speechButton = new ImageButton(this);
        
        speechButton.setLayoutParams(ibParams);
        speechButton.setContentDescription(m_Resources.getString(R.string.AddSpeechItemString));
        speechButton.setOnClickListener(new View.OnClickListener()
        {... });
        speechButton.setImageDrawable(m_Resources.getDrawable(R.drawable.micro2));
        
        TopLayout.addView(speechButton);
    
      }

</code>

But the result is a button to the right (as desired) and a ImageButton to the left. :(

Could anyone help me? O.o

Cheers

Chris

