Android设置android:clipChildren达到的特殊UI设计效果
2018-01-04 00:00
260 查看
Android设置android:clipChildren达到的特殊UI设计效果
在Android的布局XML文件中,有一个不常用的属性android:clipChildren,该属性值可设为true或者false。
该属性控制Android的一个子view是否运行超越父控件边界放置。Android系统默认赋予该属性值是true,即不允许超越所在父布局的边界。如果设置为false,则表示允许该子view超越父布局的边界。
当把android:clipChildren的属性设置为false后,在Android的UI设计中会产生一些比较有趣的设计效果,比如下面一个在LinearLayout布局中简单水平并排放置的若干ImageView效果,如图:
其实现代码(布局XML)为:
android:layout_gravity="bottom" , 告知Android系统要从底部向上绘制该子view。
Android设置android:clipChildren达到的特殊UI设计效果
在Android的布局XML文件中,有一个不常用的属性android:clipChildren,该属性值可设为true或者false。
该属性控制Android的一个子view是否运行超越父控件边界放置。Android系统默认赋予该属性值是true,即不允许超越所在父布局的边界。如果设置为false,则表示允许该子view超越父布局的边界。
当把android:clipChildren的属性设置为false后,在Android的UI设计中会产生一些比较有趣的设计效果,比如下面一个在LinearLayout布局中简单水平并排放置的若干ImageView效果,如图:
其实现代码(布局XML)为:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:clipChildren="false" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="100dip" android:background="#e57373" /> <LinearLayout android:layout_width="match_parent" android:layout_height="50dip" android:background="#2196f3" android:orientation="horizontal" > <ImageView android:layout_width="wrap_content" android:layout_height="match_parent" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="50dip" android:layout_gravity="bottom" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="70dip" android:layout_gravity="bottom" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="90dip" android:layout_gravity="bottom" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="110dip" android:layout_gravity="bottom" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="130dip" android:layout_gravity="bottom" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="150dip" android:layout_gravity="bottom" android:src="@drawable/ic_launcher" /> <ImageView android:layout_width="wrap_content" android:layout_height="170dip" android:layout_gravity="bottom" android:src="@drawable/ic_launcher" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="100dip" android:background="#4dd0e1" /> </LinearLayout>
android:layout_gravity="bottom" , 告知Android系统要从底部向上绘制该子view。
相关文章推荐
- Android设置android:clipChildren达到的特殊UI设计效果
- Android clipChildren与clipToPadding使用以及简单ViewPager自定义切换效果
- android JBOX2D粒子碰撞的实例,以达到特殊效果
- Android UI设计系列之HTML标签实现TextView设置中文字体加粗效果(6)
- android中给TextView设置属性ellipsize, 过长自动隐藏 或 跑马灯效果
- Fragment实现android的设置界面切换效果
- Android TextView 设置超链接、关键字高亮等效果
- 【Android UI设计与开发】第03期:引导界面(三)仿微信引导界面以及动画效果
- android 设置自定义dialog大小无效果
- Android Paint类介绍以及浮雕和阴影效果的设置
- android中xml设置Animation动画效果详解
- android 使用clip.xml 作为drawable 作成进度条图片效果
- android 成长 UI 学习之 Activity 透明,半透明效果的设置transparent
- android文字阴影效果设置
- Android CardView 设置点击效果
- 切割子视图越界的部分【将越界部分设置为不可见从而达到效果】
- Android设置透明、半透明等效果
- Android设置透明、半透明等效果
- Android设置透明、半透明等效果
- 【Android UI设计与开发】第18期:滑动菜单栏(三)SlidingMenu动画效果的实现