android - Trying to change the width of a button -


i'm trying width of screen , change width of button. i'm using setwidth, , width not changing (i set small numer, 30, tell if size change. code mbut = (button)findviewbyid( r.id.butrington); // not working, set size small can tell mbut.setwidth(30); mbut.setonclicklistener(this);

layouut

 <linearlayout  android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center"  android:orientation="horizontal" >           <button         android:id="@+id/butvol"         android:layout_width="100dp"         android:layout_height="wrap_content"         android:textsize="24px"         android:text="volume"            android:textcolor="#ff0000ff"      />      <button         android:id="@+id/butrington"         android:layout_width="100dp"         android:layout_height="wrap_content"         android:textsize="24px"         android:text="rington"           android:textcolor="#ff0000ff"      />   

after hanging layout_widht wrap_content, able change width every size need.

<button     android:id="@+id/butrington"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="r"     android:textcolor="#ff0000ff"     android:textsize="24px" /> 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -