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(安卓)远程监控摄像头 移动端+PC端 旧手札变废为宝
  2. ImageView设置图片大小
  3. android stylet
  4. Android获得屏幕高度和状态栏高度
  5. ImageView的属性
  6. Notes on the implementation of encryption in Android(安卓)3.
  7. Android全屏显示 无标题栏、全屏、设置为横屏
  8. android简单的日期时间选择器
  9. 【Android】Android自定义属性,attr format取值类型

随机推荐

  1. AngularJS错误:模块ngAnimate不可用
  2. 在phonegap上从服务器获取数据
  3. JavaScript 对象属性作实参以及实参对象
  4. javascript 数据类型转换
  5. JSP+JavaScript实现图片切换
  6. 如何让react-native Picker保持新选择的
  7. 确保代码在*之后执行*对监视属性的更改已
  8. 用于填充表的倍数ng-repeat
  9. 这些年,我收集的JavaScript代码(二)
  10. 读取json并显示鼠标上的动态值