简体   繁体   English

dimens.xml-> R不生成

[英]dimens.xml -> R not generating

When I add the file dimens.xml : 当我添加文件dimens.xml时

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="smart_eyeglass_controll_width">419</dimen>
    <dimen name="smart_eyeglass_controll_height">138</dimen>
</resources>

to my values folder, R will not be generated. 到我的values文件夹中,将不会生成R。 What is wrong? 怎么了? The file is OK - the rest of the project to. 文件确定-项目的其余部分即可。 Cleaning the project up in Eclipse won't work. 在Eclipse中清理项目将无法进行。

Why it Showing 为什么显示

Because there are some compile error (or bug?) regarding to the xml file in res, so R is not genetared . 由于res中的xml文件存在一些编译错误(或bug?),因此R不被生成。

So,basically just Add unit beside your dimen value Like dp 因此,基本上只是在您的dimen值旁边添加单位,例如dp

    <?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="smart_eyeglass_controll_width">419dp</dimen>
    <dimen name="smart_eyeglass_controll_height">138dp</dimen>
</resources>

Then rebuild and clean your project 然后重建并清理您的项目

because you can't create dimens whiteout indicating that whether its a dip or sp or... if you want to create an integer value use: 因为您无法创建变暗的变白,表示是否为dip或sp或...,如果要创建整数值,请使用:

<integer name="something">100</integer>

and if it has a unit put it.. 如果有单位的话

<dimen name="width">100dip</dimen>

you have to specify an unit for your value, such dp . 您必须为您的值指定一个单位,例如dp Eg 例如

<resources>
    <dimen name="smart_eyeglass_controll_width">419dp</dimen>
    <dimen name="smart_eyeglass_controll_height">138dp</dimen>
</resources>

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

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