高校网站建设的目的和意义,暴雪公司现状,网站设计与网页制作培训,网站怎么做七牛云加速Android LinearLayout 如何让子元素靠下居中对齐 center bottom
首先你需要知道两个知识点#xff1a;
android:layout_gravity 指定的是当前元素在父元素中的位置android:gravity 指定的是当前元素子元素的排布位置
比如#xff1a;
有这么一个布局#xff0c;我需要让…Android LinearLayout 如何让子元素靠下居中对齐 center bottom
首先你需要知道两个知识点
android:layout_gravity 指定的是当前元素在父元素中的位置android:gravity 指定的是当前元素子元素的排布位置
比如
有这么一个布局我需要让它靠下居中对齐LinearLayout 上的 gravity center 是对的指定的是它的子元素应该居中排布。 LinearLayoutandroid:gravitycenterandroid:orientationhorizontalandroid:layout_marginBottom20dpandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentImageViewandroid:layout_marginEnd10dpandroid:layout_width35dpandroid:layout_height35dpandroid:srcmipmap/ic_launcher/ImageViewTextViewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textColorcolor/whiteandroid:text蓝牙权限状态android:textSize24dpandroid:textFontWeight600/TextViewandroid:layout_marginLeft10dpandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textColorcolor/garyandroid:textstring/versionandroid:textSize16dp/
/LinearLayout那么如何让子元素靠下排列呢那就是子元素该定义的了所以我们在每个子元素中再添加 layout_gravity bottom 即可。