When i make a button in XML... it's size change from one device to another it's seem small in one device and very big on another and how can i make a constant size at every device that "APK" Setup ?
当我用XML制作一个按钮时......它的大小从一个设备变为另一个设备,它在一个设备中看起来很小而在另一个设备上看起来很大,我如何在每个“APK”设置的设备上制作一个恒定的大小?
2 个解决方案
#1
0
Define the exact width and height for the button on your layout xml,
在布局xml上定义按钮的确切宽度和高度,
android:layout_width="100dp"
android:layout_height="30dp"
#2
0
For do this you can use dp, dpi unit in layout_whidth and layout_height parameters. Instead wrap_content or fill_parent, this units are designed for do that.
为此,您可以在layout_whidth和layout_height参数中使用dp,dpi单位。而不是wrap_content或fill_parent,这个单位是为这样做而设计的。
Then you can define with this units to obtain a constant size of your button on all screens.
然后,您可以使用此单位定义,以在所有屏幕上获得恒定大小的按钮。
#1
0
Define the exact width and height for the button on your layout xml,
在布局xml上定义按钮的确切宽度和高度,
android:layout_width="100dp"
android:layout_height="30dp"
#2
0
For do this you can use dp, dpi unit in layout_whidth and layout_height parameters. Instead wrap_content or fill_parent, this units are designed for do that.
为此,您可以在layout_whidth和layout_height参数中使用dp,dpi单位。而不是wrap_content或fill_parent,这个单位是为这样做而设计的。
Then you can define with this units to obtain a constant size of your button on all screens.
然后,您可以使用此单位定义,以在所有屏幕上获得恒定大小的按钮。