分配“WRAP_CONTENT”或“-2”维度 [英] Assigning 'wrap_content' or '-2' to dimension
问题描述
我要创造出有等于'WRAP_CONTENT不变。
I want to create a dimension that would be equal to 'wrap_content' constant.
所以,根据<一个href=\"http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html\">developer.android.com参考我写的:
<dimen name="horizontal_border_height">-2</dimen>
但ADT说:
错误:整数类型不允许(在'horizontal_border_height,值为-2')
Error: Integer types not allowed (at 'horizontal_border_height' with value '-2')
Asigning'WRAP_CONTENT的价值产生错误了。
Asigning 'wrap_content' value generates error too.
我是什么做错了吗?任何想法如何使它工作?
What am I doing wrong? Any ideas how to make it work?
推荐答案
检查出的应用程序资源API指南
你可以看到支持联信的尺寸值。
不能使用维度传递一个WRAP_CONTENT作为浏览维度。
Check out app resources API guide and you can see supported unites for a dimension value. You can't use dimension to pass a wrap_content as a Views dimension.
这篇关于分配“WRAP_CONTENT”或“-2”维度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!