This is my code for the button. Thing is, it’s the same size on all devices. It’s big on small ones and small on big ones. How do I alter its size relatively? Here’s my code.
<Button
android:id="@+id/button1"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_margin="3dp"
android:background="@drawable/blue_gradient"
android:layout_alignRight="@+id/relativeLayout1"
android:layout_alignTop="@+id/relativeLayout1"/>
I would like the size to be consistent, depending upon the device’s resolution.
EDIT
I want the buttons to be square.
the best way is to use
android:layout_width="wrap_content"android:layout_height="wrap_content"
It manages size for all devices very well.
For square buttons you need to set width/height in the code. this will help you.