我有很多控制在我的 XML
(A 按钮
为例)重复。有没有在一个 XML
写按钮
键,然后导入所有我需要它的布局的可能性?
I have lots of control repeated in my xml
(a Button
for instance). Is there any possibility to write the Button
once in a xml
and then import it in all the layout I need it?
您可以使用
<include layout="@layout/commonlayout" android:id="@+id/id" />
commonlayout.xml
应 RES /布局定义
,您可以添加重复的部分。
commonlayout.xml
should be defined in res/layout
where you can add the repeated parts.