Android自定义属性

找到 “D:\eclispe_android\eclipse_en_32_4.4\sdk\platforms\android-22\data\res\values” Android SDK自带的属性文件,截取一段Android的自定义属性:

    <declare-styleable name="TextView">
        <!-- Determines the minimum type that getText() will return.
             The default is "normal".
             Note that EditText and LogTextBox always return Editable,
             even if you specify something less powerful here. -->
        <attr name="bufferType">
            <!-- Can return any CharSequence, possibly a
             Spanned one if the source text was Spanned. -->
            <enum name="normal" value="0" />
            <!-- Can only return Spannable. -->
            <enum name="spannable" value="1" />
            <!-- Can only return Spannable and Editable. -->
            <enum name="editable" value="2" />
        </attr>
        <!-- Text to display. -->
        <attr name="text" format="string" localization="suggested" />
        <!-- Hint text to display when the text is empty. -->
        <attr name="hint" format="string" />
        <!-- Text color. -->
        <attr name="textColor" />
        <!-- Color of the text selection highlight. -->
        <attr name="textColorHighlight" />
        <!-- Color of the hint text. -->
        <attr name="textColorHint" />
        <!-- Base text color, typeface, size, and style. -->
        <attr name="textAppearance" />
        <!-- Size of the text. Recommended dimension type for text is "sp" for scaled-pixels (example: 15sp). -->
        <attr name="textSize" />
        <!-- Sets the horizontal scaling factor for the text. -->
        <attr name="textScaleX" format="float" />
        <!-- Typeface (normal, sans, serif, monospace) for the text. -->
        <attr name="typeface" />
        <!-- Style (bold, italic, bolditalic) for the text. -->
        <attr name="textStyle" />
        <!-- Font family (named by string) for the text. -->
        <attr name="fontFamily" />
        <!-- Text color for links. -->
        <attr name="textColorLink" />
        <!-- Makes the cursor visible (the default) or invisible. -->
        <attr name="cursorVisible" format="boolean" />

其他的还有比如:

    <declare-styleable name="LinearLayout">
        <!-- Should the layout be a column or a row?  Use "horizontal"
             for a row, "vertical" for a column.  The default is
             horizontal. -->
        <attr name="orientation" />
        <attr name="gravity" />
        <!-- When set to false, prevents the layout from aligning its children's
             baselines. This attribute is particularly useful when the children
             use different values for gravity. The default value is true. -->
        <attr name="baselineAligned" format="boolean" />
        <!-- When a linear layout is part of another layout that is baseline
          aligned, it can specify which of its children to baseline align to
          (that is, which child TextView).-->
        <attr name="baselineAlignedChildIndex" format="integer" min="0"/>
        <!-- Defines the maximum weight sum. If unspecified, the sum is computed
             by adding the layout_weight of all of the children. This can be
             used for instance to give a single child 50% of the total available
             space by giving it a layout_weight of 0.5 and setting the weightSum
             to 1.0. -->
        <attr name="weightSum" format="float" />
        <!-- When set to true, all children with a weight will be considered having
             the minimum size of the largest child. If false, all children are
             measured normally. -->
        <attr name="measureWithLargestChild" format="boolean" />
        <!-- Drawable to use as a vertical divider between buttons. -->
        <attr name="divider" />
        <!-- Setting for which dividers to show. -->
        <attr name="showDividers">
            <flag name="none" value="0" />
            <flag name="beginning" value="1" />
            <flag name="middle" value="2" />
            <flag name="end" value="4" />
        </attr>
        <!-- Size of padding on either end of a divider. -->
        <attr name="dividerPadding" format="dimension" />
    </declare-styleable>

转载于:https://www.cnblogs.com/CVstyle/p/6399203.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值