MainActivity如下:
package cc.testclipchildren;import android.os.Bundle;import android.app.Activity;/** * android:clipChildren属性的分析 * 该属性默认值为android:clipChildren="true" * 单从字面意思理解clipChildren的意思是:裁剪(缩短)孩子 * 我们将其值设置为false后那么当子控件的高度高于父控件时 * 也会完全显示,而不会被压缩. * 比如在此例中: * 父类线性布局高度指定为50dip * 但是第二个ImageView的高度设置为了70dip. * 但是该图片依然正常地完整显示,不会只显示一部分 * 在此可以设置 android:clipChildren="true"观察效果 *  * 注意事项: * 在布局的根节点设置该属性android:clipChildren *  * 参考资料: * 1 http://www.cnblogs.com/over140/p/3508335.html * 2 http://www.chengxuyuans.com/Android/66745.html *   Thank you very much * */public class MainActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);}}


main.xml如下:

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:clipChildren="false"    >       <LinearLayout        android:layout_width="match_parent"        android:layout_height="50dip"        android:layout_centerInParent="true"        android:orientation="horizontal" >        <ImageView            android:layout_width="0dip"            android:layout_height="fill_parent"            android:layout_weight="1.0"            android:scaleType="fitCenter"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="0dip"            android:layout_height="70dip"            android:layout_gravity="bottom"            android:layout_weight="1.0"            android:scaleType="fitCenter"            android:src="@drawable/ic_launcher" />        <ImageView            android:layout_width="0dip"            android:layout_height="fill_parent"            android:layout_weight="1.0"            android:scaleType="fitCenter"            android:src="@drawable/ic_launcher" />    </LinearLayout></RelativeLayout>



更多相关文章

  1. Android开发UI之自定义控件的皮肤
  2. Android获得屏幕高度和状态栏高度
  3. ImageView的属性
  4. Android仿iOS左右滑动开关控件(Android4.0以上适用)
  5. 【Android】Android自定义属性,attr format取值类型
  6. Android使用TextView,设置onClick属性无效解决办法
  7. 【063】◀▶ Android (I) - 控件和布局
  8. 【Android开发小记--6】动画--属性动画以及Fragment切换动画(3D)

随机推荐

  1. 普通人维权难?收藏这6个超管用的投诉网站,
  2. 点击就看程序员“神仙斗法”:只有13kb的绝
  3. 中国特供“恐怖”游戏:《作业疯了》上架St
  4. 喜大普奔:百度浏览器黯淡退场,停用联网功能
  5. 口碑“崩坏”的《和平精英》上线吸金,3天
  6. 装机必备!网页管理Chrome扩展四大神器,让浏
  7. 谷歌也翻车了?全球数亿安卓设备难逃一“劫
  8. 今日沙雕新闻:精英员工离职引公司动荡,老板
  9. 几款堪称神器的图片无损放大缩小工具!
  10. 公益推荐:支付宝“白鲸鱼”,捐旧衣换蚂蚁能