我在我的xml
(Button
例如)中重复了很多控制.是否有可能Button
在一个a中编写一次xml
,然后在我需要的所有布局中导入它?
Lab*_*lan 102
您可以使用
<include layout="@layout/commonlayout" android:id="@+id/id" />
Run Code Online (Sandbox Code Playgroud)
commonlayout.xml
应该在res/layout
可以添加重复部分的位置定义.
Tsi*_*moX 23
正如Labeeb P正确地说,它有效.只想添加你也可以覆盖参数:
<include
layout="@layout/commonlayout"
android:id="@+id/id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="2sp"
android:layout_marginRight="2sp"
/>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
27917 次 |
最近记录: |