开发者

Will <include> override the layout_width/layout_height value?

开发者 https://www.devze.com 2022-12-29 14:16 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号