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(relativeLayo
For RelativeLayout.LayoutParams
rules, 0
means false
, and only applies to rules that don't refer to sibling View
s, 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
.