我试图将版权图片放在我的 LinearLayout
的底部,并带有“include 标签”。我做得很成功,但是当我尝试将 android:layout_marginTop="330dp"
或 android:layout_marginBottom="20dp"
添加到我的 include 时 - 它不显示在用户界面中。
有什么问题?
这是我的代码: 版权.xml:
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:src="@drawable/copyrights"
android:id="@+id/copyrights"
android:layout_width="fill_parent"
android:layout_height="40dip"/>
</merge>
我的布局.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:padding="10dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<include layout="@layout/copyrights" android:layout_marginTop="330dp"/>
</LinearLayout>
最佳答案
<include />
标签基本上是 android 布局框架的复制和粘贴指令。它不是布局层次结构中的实际对象。这意味着它不能有边距/填充/大小/任何其他布局属性。
将边距分配给 <ImageView />
在您的布局中。
关于android-layout - 使用 "merge"和 "include",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8156010/