zoukankan      html  css  js  c++  java
  • XML Bitmap

    XML Bitmap

    XML Bitmap 是一个用XML定义的文件放在资源目录,定义的对象是图片,为bitmap定义别名,这个文件可以给bitmap定义一些额外的属性。例如:抖动。

    文件存放位置:
    res/drawable/filename.xml

    语法:
    <?xml version="1.0" encoding="utf-8"?>
    <bitmap
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:src="@[package:]drawable/drawable_resource"
        android:antialias=["true" | "false"]
        android:dither=["true" | "false"]
        android:filter=["true" | "false"]
        android:gravity=["top" | "bottom" | "left" | "right" | "center_vertical" |
                          "fill_vertical" | "center_horizontal" | "fill_horizontal" |
                          "center" | "fill" | "clip_vertical" | "clip_horizontal"]
        android:tileMode=["disabled" | "clamp" | "repeat" | "mirror"] />


    例子:
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity" >
    	<!-- 与默认情况(@drawable/btn_default_pressed_holo_light)有差别 --> 
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true"
            android:background="@drawable/bm"
            android:text="sssssssssssssssssss" />
    
    </RelativeLayout>

    效果图:

    默认(@drawable/btn_default_pressed_holo_light)

    引用(@drawable/bm):

    从截图上就可以看出来差别。

    titileMode="repeat":




  • 相关阅读:
    Win7下使用TortoiseGit设置保存密码
    MacOS软件清单
    ubuntu安装python
    Mac使用SSH连接远程服务器
    CentOS常用命令
    Docker追加容器端口映射
    Docker安装CentOS7
    Windows操作路由表
    Docker部署MySQL8并实现远程连接
    Qt——容器类(译)
  • 原文地址:https://www.cnblogs.com/java20130722/p/3207260.html
Copyright © 2011-2022 走看看