Reputation: 2396
Eclipse is able to render my layout when it includes:
...
<shape>
...
<stroke>
...
android:width="@strings/someWidth"
where someWidth is defined in strings.xml as
<string name="someWidth">5dp</string>
but it crashes on a real device, and only works if I use a direct string, like:
android:width="5dp"
How can I use a resource for the stroke width?
Upvotes: 0
Views: 347
Reputation: 25761
Try to use the dimension resources.
Create a dimens.xml
file inside your values folder with the following:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="some_width">5dp</dimen>
</resources>
You can refer to this using @dimen/some_width
.
Upvotes: 1