gpt4 book ai didi

Android SDK layout_width 和layout_height xml 属性继承?

转载 作者:数据小太阳 更新时间:2023-10-29 02:58:22 24 4
gpt4 key购买 nike

我一直在尝试开始使用 Android 操作系统进行编程。使用网站上的教程,我看到 LinearLayout、GridLayout 等 View 使用 layout_width 和 layout_height xml 属性,但文档从未显示这些布局的这些属性的继承。我已阅读需要它们的地方,但看不到它们如何使用它们从未继承的东西。

希望是一个一直困扰着我的简单问题。

最佳答案

检查 http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.htmlhttp://developer.android.com/guide/topics/ui/declaring-layout.html

XML layout attributes named layout_something define layout parameters for the View that are appropriate for the ViewGroup in which it resides.

Every ViewGroup class implements a nested class that extends ViewGroup.LayoutParams. This subclass contains property types that define the size and position for each child view, as appropriate for the view group. As you can see in figure 1, the parent view group defines layout parameters for each child view (including the child view group).Note that every LayoutParams subclass has its own syntax for setting values. Each child element must define LayoutParams that are appropriate for its parent, though it may also define different LayoutParams for its own children.

All view groups include a width and height (layout_width and layout_height), and each view is required to define them.

关于Android SDK layout_width 和layout_height xml 属性继承?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10636962/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com