Reputation: 51
I'm making two buttons.
if One button is clicked, the other button's text is changed.
I coded initial status using setText
mBtn.setOnClickListener(this);
mBtn.setText("Connect");
and changing text using
mBtn.setText("Disconnect");
In this case, button's length is fixed initial length.
What can i do?
Upvotes: 0
Views: 217
Reputation: 181
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Connect"
android:padding="5dp"
/>
Upvotes: 0
Reputation: 546
use this on your layout it will work. remove fixed width first.
android:layout_width="wrap_content"
Upvotes: 2