您需要将 尺寸 资源定义为 减量 而不是 字符串 。因此,将您
@string/marginbutton从 strings.xml 移至
res / values / dimens.xml 为
<?xml version="1.0" encoding="utf-8"?><resources> <dimen name="marginbutton">8dp</dimen></resources>
您的错误基本上抱怨传递期望的
<string>资源
<dimen>。

您需要将 尺寸 资源定义为 减量 而不是 字符串 。因此,将您
@string/marginbutton从 strings.xml 移至
<?xml version="1.0" encoding="utf-8"?><resources> <dimen name="marginbutton">8dp</dimen></resources>
您的错误基本上抱怨传递期望的
<string>资源
<dimen>。