我正在尝试按照以下方式从
strings.xml
中的常量字符串设置ImageView
的高度和宽度:
<ImageView
android:id="@+id/GetMailing"
android:layout_width="@string/continueBtnWidthHD"
android:layout_height="@string/continueBtnHeightHD"
android:layout_gravity="center"
android:src="@drawable/continue_button_style" />
在 strings.xml
中,我有:
<string name="continueBtnHeightHD">60dp</string>
<string name="continueBtnWidthHD">250dp</string>
但是,在执行setContentView(view_Id)
时会出现错误。
错误为java.lang.RuntimeException: Binary XML file line #82: You must supply a layout_width attribute.
我使用这种方法是因为我想在各个地方使用相同的值。
这有点奇怪,因为我使用同样的方法来设置EditText
的maxlength
,它运行得很好。
我是否做错了什么?
任何帮助都将不胜感激。
dimen
。错别字已经修正。谢谢。 - fasteque