Android : Android- Setting width of a TextView to left of either button-1 or button-2

on Sunday, August 3, 2014


I've a TextView and 2 (custom)buttons to the right of the TextView. The 2 buttons and the TextView are included in a Single RelativeLayout. Now, at any point of time, either button-1 or button-2 will be visible. Since I won't be knowing which button will be visible, in my code for both buttons, I've added android:layout_toRightOf="@+id/MyTextView" property in the XML file. Which works fine. This places the button based on the position(and width) of the TextView.


The issue : After language change, I have to change the width of the TextView based on the width of the Button to its right. I tried minWidth/maxWidth for both the buttons and the TextView as well, but they still don't allow dynamic resizing of the TextView based on the button's width.


Is there anyway where I can specify : android:layout_toLeftOf="@+id/button1 | @+id/button2" i.e, textView to left of either button-1 or button-2. So that the text view will be aligned based on the button to its right?


0 comments:

Post a Comment