Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何通过引用其属性来获取组件?
Button attribute1 = "@+myAttributes/one"/> //something like Button Button1 = (Button) findViewByattribute1(R.myAttributes.one);
尝试使用以下代码。
Button buttonName = (Button) findViewById(R.id.yourButton);