Android clipChild属性应用

1870221-bc21d92b91f8e58b.png
image.png

如果我们要实现这个布局,一般都是用相对布局RelativeLayout来实现,但是有个更简单的多的方法。

clipChildren 属性

这个属性我们不常用,他的意思是是否裁剪子view,用的时候注意添加android:layout_gravity位置靠下还是靠哪里。

这是效果图~

1870221-e8690f9493a16677.png
image.png

1870221-a6c45808cf4f08ec.png
image.png

这是代码~

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorAccent"
    android:clipChildren="false"
    tools:context="org.lenve.myviewpagercards2.Main2Activity">

   <LinearLayout
     
       android:orientation="horizontal"
       android:layout_alignParentBottom="true"
       android:background="@color/colorPrimary"
       android:layout_width="match_parent"
       android:layout_height="50dp">
       <ImageView
           android:layout_width="0dp"
           android:layout_height="match_parent"
           android:layout_weight="1"
           android:src="@mipmap/ic_launcher"/>
       <ImageView

           android:layout_width="0dp"
           android:layout_height="match_parent"
           android:layout_weight="1"
           android:src="@mipmap/ic_launcher"/>
       <ImageView
           android:layout_gravity="bottom"
           android:layout_width="0dp"
           android:layout_height="72dp"
           android:layout_weight="1"
           android:src="@mipmap/ic_launcher"/>
       <ImageView
           android:layout_width="0dp"
           android:layout_height="match_parent"
           android:layout_weight="1"
           android:src="@mipmap/ic_launcher"/>
       <ImageView
       android:layout_width="0dp"
       android:layout_height="match_parent"
       android:layout_weight="1"
       android:src="@mipmap/ic_launcher"/>
   </LinearLayout>
</RelativeLayout>

大家可以点个关注,告诉我大家想要深入探究哪些问题,希望看到哪方面的文章,我可以免费给你写专题文章。。哈哈。。。
希望大家多多支持。。你的一个关注,是我坚持的最大动力。。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值