Skip to content Skip to sidebar Skip to footer

Relativelayout.right_of Does Not Work

I am trying to create a textview and a button programmatically in the existing relative layout. The idea is to put the textview in the left corner of the parentView(relativeLayout)

Solution 1:

For RelativeLayout.LayoutParams rules, 0 means false, and only applies to rules that don't refer to sibling Views, such as CENTER_IN_PARENT. Since you've set your TextView's ID to 0, the RIGHT_OF rule you're adding is being ignored, as false doesn't make sense with that.

To remedy this, simply set the TextView's ID to any positive int value; e.g., 1.

Post a Comment for "Relativelayout.right_of Does Not Work"