在 values 中写下如下: <item name="thisIsID" type="id" /> 其中 name 就是最后的 id, 然后在代码中使用: showBtn.id = R.id.thisIsID 亲自实践有效.