简体   繁体   English

XML预览看起来与设备中的有所不同

[英]XML Preview looks different than in device

As written in the topic, I have an android App, which has a design - that design is being shown differently on my Phone than in the XML-Preview. 就像在主题中所写的那样,我有一个具有设计的android应用-该设计在我的手机上显示的方式与在XML预览中显示的方式不同。

Screenshots: 屏幕截图: 在Android Studio中在我的设备中

As you can see on my device, the button at the bottom is far more in the top than it should be. 正如您在我的设备上看到的那样,底部的按钮比顶部的要多得多。 Any fixes? 有任何解决办法吗?

This is because of the screen size. 这是因为屏幕大小。 If you are just stacking the views in a LinearLayout they will take up whatever room they need and the the bottom will be blank. 如果您只是将视图堆叠在LinearLayout中,则它们将占用所需的任何空间,而底部将为空白。 If you want you can make the button be pushed to the bottom by using layout_weight=1 on whichever view you want to take up the remaining space. 如果需要,可以在要占用剩余空间的任何视图上使用layout_weight=1将按钮推到底部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM