1
所以,我有兩個文件:layout_margin不包括繼承的ImageView
where_include_happens.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/hours"
android:layout_height="wrap_content"
android:layout_width="60dp">
<include android:id="@+id/some_id"
layout="@layout/whats_included"
android:layout_width="18dp"
android:layout_height="18dp" />
</RelativeLayout>
而且
whats_included.xml
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_margin="6dp"
android:contentDescription="@string/some_description"
android:src="@drawable/some_awesome_drawable" />
我的問題是,這些元素中的每個人都應該有android:layout_margin="6dp"
參數,但它似乎被忽略通過包括:(。只有在documentation,我發現相關的東西是:
注意:如果要使用標記覆蓋佈局屬性,則必須覆蓋android:layout_height和android:layout_width以使其他佈局屬性生效。
我的問題是:
有什麼事,我沒有看到,還是我註定要寫入android:layout_margin="6dp"
在每一個在自己的項目?
哇!這太棒了!我是新來的android,我不知道這種機制甚至存在於API中!這也解決了我的其他許多問題,謝謝! +1 – meeDamian