开发者

Using resource values as layout attributes (config.xml)

开发者 https://www.devze.com 2022-12-24 04:17 出处:网络
Looking in the android sdk folders, I\'ve found a file called values/config.xml.This seems to be somewhere that you can define values for later use in layouts and animations.

Looking in the android sdk folders, I've found a file called values/config.xml. This seems to be somewhere that you can define values for later use in layouts and animations.

Given the config.xml:

<resources>
    <string name="config_somePadding">50dip</string>
</resources>

How would I reference this to use as the layout_height in a layout xml file?

@string/config_somePadding is actually the only one I've found that d开发者_Go百科oesn't throw an error in Eclipse (even though there isn't a config_somePadding in values/strings.xml), but it appears to just put an empty string.

In the sdk, they use an integer for animation duration. They reference it like this: android:duration="@android:integer/config_longAnimTime". Is there a way to use values that aren't integers in the layout_height attribute?


How would I reference this to use as the layout_height in a layout xml file?

You wouldn't. Use a dimension resource instead.

Is there a way to use values that aren't integers in the layout_height attribute?

You have to use a dimension resource for dimensions.

0

精彩评论

暂无评论...
验证码 换一张
取 消