Android的延伸,而不是在res文件夹中加载正确的文件布局文件 [英] Android stretches the layout file instead of loading the correct file in the res folders

查看:132
本文介绍了Android的延伸,而不是在res文件夹中加载正确的文件布局文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个活动的手机版和同样活动的平板电脑的版本。我的手机版本是 RES /布局/ activity.xml 而我的7平板电脑的版本是 RES /布局sw600dp / activity.xml

I have a handset version of an activity and a tablet version of the same activity. My handset version is res/layout/activity.xml while my 7' tablet version is res/layout-sw600dp/activity.xml

的事情是,当我运行在一个7平板电脑的应用程序,它不仅不会加载XML文件中的 RES /布局sw600dp ,但它显示布局中的 RES /布局文件夹加长版。所以,一切从按钮,图片,以及操作栏本身是简单的伸展和变形以填满整个屏幕(大致相同的方式在iPad显示一个iPhone应用程序的2X版本)。

The thing is that when I run the app in a 7' tablet, not only does it not load the xml file in res/layout-sw600dp, but it displays a stretched version of the layout in the res/layout folder. So, everything from buttons, images, as well as the action bar itself is simply stretched and distorted to fill the whole screen (much the same way an iPad displays the 2X version of an iPhone app).

我是用Android的工作室,这是工作的罚款,但我不得不切换到Eclipse为这是不相关的原因,让我怀疑它可能是Eclipse的配置有关,但它只是胡乱猜测。

I was using Android Studio and it was working fine, but I had to switch to Eclipse for reasons which aren't relevant, so I suspect it might be something related to Eclipse's configuration, but it's just a wild guess.

我以前从来没有过这样的问题。有没有人经历过这个,发现一个解决方案吗?谢谢你。

I've never had this issue before. Has anyone ever experienced this and found a solution? Thanks.

PD。如果我使用Eclipse的布局编辑器,选择preVIEW所有尺寸,它实际上加载正确的XML到7'和10'previews。

pd. If I use Eclipse's layout editor and select "Preview all sizes", it actually loads the correct xml into the 7' and the 10' previews.

推荐答案

找到了解决办法。是什么造成了这种怪异的行为是我错过了我的的Andr​​oidManifest.xml 文件中的以下属性:

Found a solution. What was causing this weird behavior is that I was missing the following attributes in my AndroidManifest.xml file:

<uses-sdk android:minSdkVersion="9"
      android:targetSdkVersion="19"
      android:maxSdkVersion="19" />

这篇关于Android的延伸,而不是在res文件夹中加载正确的文件布局文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆