日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

关于LayoutParams

發布時間:2024/1/23 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 关于LayoutParams 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

每一個布局均有一個叫LayoutParams的內部類,如:

LinearLayout.LayoutParams ?RelativeLayout.LayoutParams ?AbsoluteLayout.LayoutParams ?TableLayout.LayoutParams ?TableLayout.LayoutParams ?FrameLayout.LayoutParams

此內部類用于指明某個view在其父元素中的位置,以linearLayout為例:

Per-child layout information associated with LinearLayout.

Standard gravity constant that a child supplies to its parent. Defines how the child view should be positioned, on both the X and Y axes, within its enclosing layout.

在LinearLayout中,只有2個xml屬性:layout_gravity, layout_weight

但在RelativeLayout中,由于其涉及較多的位置選項,因此有多個xml屬性:

Attribute Name Related Method Description
android:layout_above ? Positions the bottom edge of this view above the given anchor view ID.?
android:layout_alignBaseline ? Positions the baseline of this view on the baseline of the given anchor view ID.?
android:layout_alignBottom ? Makes the bottom edge of this view match the bottom edge of the given anchor view ID.?
android:layout_alignEnd ? Makes the end edge of this view match the end edge of the given anchor view ID.?
android:layout_alignLeft ? Makes the left edge of this view match the left edge of the given anchor view ID.?
android:layout_alignParentBottom ? If true, makes the bottom edge of this view match the bottom edge of the parent.?
android:layout_alignParentEnd ? If true, makes the end edge of this view match the end edge of the parent.?
android:layout_alignParentLeft ? If true, makes the left edge of this view match the left edge of the parent.?
android:layout_alignParentRight ? If true, makes the right edge of this view match the right edge of the parent.?
android:layout_alignParentStart ? If true, makes the start edge of this view match the start edge of the parent.?
android:layout_alignParentTop ? If true, makes the top edge of this view match the top edge of the parent.?
android:layout_alignRight ? Makes the right edge of this view match the right edge of the given anchor view ID.?
android:layout_alignStart ? Makes the start edge of this view match the start edge of the given anchor view ID.?
android:layout_alignTop ? Makes the top edge of this view match the top edge of the given anchor view ID.?
android:layout_alignWithParentIfMissing ? If set to true, the parent will be used as the anchor when the anchor cannot be be found for layout_toLeftOf, layout_toRightOf, etc.?
android:layout_below ? Positions the top edge of this view below the given anchor view ID.?
android:layout_centerHorizontal ? If true, centers this child horizontally within its parent.?
android:layout_centerInParent ? If true, centers this child horizontally and vertically within its parent.?
android:layout_centerVertical ? If true, centers this child vertically within its parent.?
android:layout_toEndOf ? Positions the start edge of this view to the end of the given anchor view ID.?
android:layout_toLeftOf ? Positions the right edge of this view to the left of the given anchor view ID.?
android:layout_toRightOf ? Positions the left edge of this view to the right of the given anchor view ID.?
android:layout_toStartOf ? Positions the end edge of this view to the start of the given anchor view ID.?

總而言之,LayoutParams子類用于指定某個元素的位置信息。



總結

以上是生活随笔為你收集整理的关于LayoutParams的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。