Will <include> override the layout_width/layout_height value?
I have a layout xml file named my_layout.xml, in which the root view's layout_width and layout_height has been specified as 200px.
<com.jlee.demo.MyLayout
xmlns:android="http://schemas.android.com/apk/开发者_JAVA技巧res/android"
android:orientation="horizontal"
android:layout_width="200px"
android:layout_height="200px">
If I used this xml to be included in another xml, and specify the layout_width and layout_height as 100px.
<include layout="@layout/my_layout"
android:layout_width="100px"
android:layout_height="100px"/>
What would be the real width/height of my_layout?
the top voted answer in this question should help you:
Does Android XML Layout's 'include' Tag Really Work?
you can only override parameters which start with layout_. so in your case, the layout should be 100*100.
Overriding android:layout_below seems to not work
If you want to override any of the layout_* attributes with tag, both layout_width and layout_height are must to be over-ridden.
See last lines of include section at http://developer.android.com/training/improving-layouts/reusing-layouts.html#Include
精彩评论