zoukankan      html  css  js  c++  java
  • InsetDrawable

    表示把一个Drawable嵌入到另外一个Drawable的内部,并且在内部留一些间距, 类似与Drawable的padding属性,但padding表示的是Drawable的内容与Drawable本身的边距! 而InsetDrawable表示的是两个Drawable与容器之间的边距,当控件需要的背景比实际的边框 小的时候,比较适合使用InsetDrawable,比如使用这个可以解决我们自定义Dialog与屏幕之间 的一个间距问题,相信做过的朋友都知道,即使我们设置了layout_margin的话也是没用的,这个 时候就可以用到这个InsetDrawable了!只需为InsetDrawable设置一个insetXxx设置不同 方向的边距,然后为设置为Dialog的背景即可!

    相关属性如下:

    • 1.drawable:引用的Drawable,如果为空,必须有一个Drawable类型的子节点!
    • 2.visible:设置Drawable是否额空间
    • 3.insetLeft,insetRight,insetTop,insetBottm:设置左右上下的边距

    ①XML中使用:

    <?xml version="1.0" encoding="utf-8"?>  
    <inset xmlns:android="http://schemas.android.com/apk/res/android"  
        android:drawable="@drawable/test1"  
        android:insetBottom="10dp"  
        android:insetLeft="10dp"  
        android:insetRight="10dp"  
        android:insetTop="10dp" /> 

    在Java代码中使用

    InsetDrawable insetDrawable = new InsetDrawable(getResources()  
            .getDrawable(R.drawable.test1), 10, 10, 10, 10); 
  • 相关阅读:
    python调用函数
    python递归函数的执行过程
    linux rwx 权限说明
    linux ssh scp免密码
    linux的bash特性
    python3常用的内置函数
    linux清理系统缓存
    vim常用命令
    公司项目安装禅道
    jquery 自定义动画
  • 原文地址:https://www.cnblogs.com/loaderman/p/10169094.html
Copyright © 2011-2022 走看看