Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to maintain the Button position when changing the text in code?
    primarykey
    data
    text
    <p>I have a button in my layout with ID <code>btnsignIn_Master</code>, and text <em>"Sign In/Sign Up"</em>. On a click event I change the text of button, then the alignment of the button changes. How to maintain the alignment even after the text changed?</p> <p>Below is my layout:</p> <pre><code>&lt;RelativeLayout android:id="@+id/LoginLayout" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/relLayoutMenu" android:layout_marginBottom="10dp" android:layout_marginTop="10dp"&gt; &lt;TextView android:id="@+id/txtLoginName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="left|center_horizontal" android:singleLine="true" android:text="Welcome" android:textColor="#E68A00" android:textSize="12sp" android:textStyle="bold" android:layout_marginLeft="1dp"&gt; &lt;/TextView&gt; &lt;Button android:id="@+id/btnsignIn_Master" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="30dp" android:layout_toRightOf="@+id/txtLoginName" android:background="@null" android:gravity="right|center_horizontal" android:onClick="btnSignIn_onclick" android:text="Sign In/Sign Up" android:textColor="#8b8989" android:textSize="12dp" &gt; &lt;/Button&gt; &lt;ImageButton android:id="@+id/iv_Arrow" android:layout_width="30dp" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_gravity="right|center_horizontal" android:layout_toRightOf="@+id/btnsignIn_Master" android:background="@null" android:onClick="btnSignIn_onclick" android:layout_marginRight="10dp" android:src="@drawable/arrow1" /&gt; </code></pre> <p></p> <p>Here is Java code:</p> <pre><code>Button ButtonSignInM= (Button) findViewById(R.id.btnsignIn_Master); ButtonSignInM.setText("Your Account"); </code></pre> <p>Am I doing anything wrong?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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