Skip to content Skip to sidebar Skip to footer

Set Same Height As Width At A Togglebutton

I have following Layout, with 7 ToggleButtons in a row. Independently from the resolution, I have always 7 Buttons in the complete horizontal width. Now I want to set the same heig

Solution 1:

Answer :

   <ToggleButton
    android:id="@+id/tB_Sa"
    android:layout_width="0dp"
    android:layout_height="50dp"
    android:background="@drawable/btntoggle_selector"
    android:textColor="@android:color/white"
    android:textOff="OFF"
    android:textOn="ON" 
    android:layout_weight="1"/>  

And:

int btnSize=tb_Mo.getWidth();
    tb_Mo.setHeight(btnSize);

Post a Comment for "Set Same Height As Width At A Togglebutton"