Note that there are some explanatory texts on larger screens.

plurals
  1. POAlign bottom for a custom RelativeLayout
    primarykey
    data
    text
    <p>Lets say that I have a custom RelativeLayout which override onMeasure :</p> <pre><code>@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); setMeasuredDimension(200, 200); } </code></pre> <p>Now I'd like to add to this Layout a View which align with the bottom of this Custom RelativeLayout. But I tried different things without any results :</p> <pre><code>paramsButton.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); addView (mButton, paramsButton); </code></pre> <p>My first guess was to align bottom with parent (which should be the custom RelativeLayout right ?). But apparently, it aligns with the parent of my custom Layout (which is another RelativeLayout, not custom this time.</p> <p>So I tried to align with id :</p> <pre><code>paramsButton.addRule(RelativeLayout.ALIGN_BOTTOM, getId()); addView (mButton, paramsButton); </code></pre> <p>but it's not working either (the button disappears) NB : I set the id of my custom RelativeLayout explicitly to check that android did get the right id.</p> <p>Do you have any idea how to make this work ?</p> <p><strong>EDIT :</strong> Funny thing : It work well with the following rule</p> <pre><code>paramsButton.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE); addView (mButton, paramsButton); </code></pre> <p>So I have to say that i really don't understand why the </p> <blockquote> <p>RelativeLayout.ALIGN_PARENT_BOTTOM</p> </blockquote> <p>rule is not working...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload