首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏全栈程序员必看

    declare-styleable使用

    declare-styleable是给自定义控件添加自定义属性用的 attr中 在attrs.xml中设置declare-styleable,name是PersonAttr <? > <resources> <declare-styleable name="PersonAttr"> <attr name="name" format="reference attr name="adult" format="boolean" /> <attr name="textSize" format="dimension" /> </declare-styleable > </resources> format就是格式,里面的就是这个属性对应的格式,下面列出来大致的格式有: reference:参考某一资源ID,以此类推 属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference" /> </declare-styleable> 属性使用: <ImageView

    56220编辑于 2022-09-14
  • 来自专栏全栈程序员必看

    android declare-styleable 和style,android – declare-styleable和style之间的区别

    在attrs.xml中,您可以直接在“资源”部分内或在“declare-styleable”中声明自定义属性: 所以现在我们将“attrib1”定义为不风格,“attrib2”为风格。

    73530编辑于 2022-09-14
  • 来自专栏全栈程序员必看

    android declare-styleable 和style,Android 关于declare-styleable属性的写法….

    我看了一些资料,说写在declare-styleable系统会自动生成数组….. 我不太明白这实际应用是什么? 如果说自动帮你生成了数组,方便使用,那写在外面的三个又有什么作用? /> <attr name=”titleTextColor” format=”color” /> <attr name=”titleTextSize” format=”dimension” /> <declare-styleable CustomTitleView”> <attr name=”titleText” /> <attr name=”titleTextColor” /> <attr name=”titleTextSize” /> </declare-styleable <declare-styleable name=”CustomTitleView”> <attr name=”titleText” format=”string” /> <attr name=”titleTextColor ” format=”color” /> <attr name=”titleTextSize” format=”dimension” /> </declare-styleable> 自定义style 声明和引用的关系

    51230编辑于 2022-09-14
  • 来自专栏全栈程序员必看

    declare-styleable的使用

    declare-styleable是给自定义控件添加自定义属性用的 1.首先,先写attrs.xml <?xml version="1.0" encoding="utf-8"? > <resources> <declare-styleable name="TestAttr"> <attr name="name" format="reference" / name="oldman" value="60" /> </attr> <attr name="textSize" format="dimension" /> </declare-styleable

    61120编辑于 2022-09-06
  • 来自专栏技术小黑屋

    自定义控件进阶:declare-styleable重用attr

    > <resources> <declare-styleable name="ExTextView"> <attr name="enableOnPad" format="boolean " /> <attr name="supportDeviceType" format="reference"/> </declare-styleable> <declare-styleable > <resources> <declare-styleable name="ExTextView"> <attr name="enableOnPad" format="boolean " /> <attr name="supportDeviceType" format="reference"/> </declare-styleable> <declare-styleable "/> </declare-styleable> </resources> 每次引用attr后,建议清理一下工程,确保R文件重新生成.

    1.8K10发布于 2018-09-04
  • 来自专栏全栈程序员必看

    declare-styleable:自定义控件的属性

    > <resources> <declare-styleable name=”ToolBar”> <attr name=”buttonNum” format=”integer 该文件是定义属性名和格式的地方,需要用<declare-styleable name=”ToolBar”></declare-styleable>包围所有属性。 1.定义: 1 2 3 <declare-styleable name="My"> <attr name="label" format="reference" > </declare-styleable </declare-styleable> 2.使用: 1 <Button zkx:myWidth="100dip"/> 五、float:浮点型 1.定义: 1 2 3 <declare-styleable " /> </declare-styleable> 2.使用: 1 <rotate zkx:pivotX="200%"/> 八、fraction:百分数 1.定义: 1 2 3 <declare-styleable

    89430编辑于 2022-09-14
  • 来自专栏全栈程序员必看

    Android自定义View之declare-styleable记录

    format 值类型 reference 资源ID color 颜色值 dimension 尺寸值 float 浮点值 string 字符串 fraction 百分数 <declare-styleable stateUnspecifed" value="0" /> <flag name="stateWindowvisible" value="1" /> </attr> </declare-styleable

    30810编辑于 2022-09-14
  • 来自专栏全栈程序员必看

    自定义属性 declare-styleable数据类型简介:

    1.定义: 1 2 3 <declare-styleable name=”My”> <attr name=”label” format=”reference” > </declare-styleable > 2.使用: 1 <Buttonzkx:label=”@string/label” > 二、Color:颜色 1.定义: 1 2 3 <declare-styleable name=”My”> < > </declare-styleable> 2.使用: 1 <Button zkx:isVisible=”false”/> 四、dimension:尺寸值 1.定义: 1 2 3 <declare-styleable ” /> </declare-styleable> 2.使用: 1 <alpha zkx:fromAlpha=”0.3″/> 六、integer:整型 1.定义: 1 2 3 <declare-styleable =”string” /> </declare-styleable> 2.使用: 1 <rotate zkx:pivotX=”200%”/> 八、fraction:百分数 1.定义: 1 2 3 <declare-styleable

    87320编辑于 2022-09-15
  • 来自专栏全栈程序员必看

    android 自定义控件 使用declare-styleable进行配置属性(源码角度)「建议收藏」

    最近在模仿今日头条,发现它的很多属性都是通过自定义控件并设定相关的配置属性进行配置,于是便查询了解了下declare-styleable,下面我把自己的使用感受和如何使用进行说明下。 declare-styleabledeclare-styleable是给自定义控件添加自定义属性用的。 之后在里面配置declare-styleable ,name为PersonAttr <?xml version="1.0" encoding="utf-8"? name = “名称”> <attr name = “textColor” format = “color” /> </declare-styleable> 3. boolean:布尔值 <declare-styleable /> </declare-styleable> 5. float:浮点值。

    1.8K20编辑于 2022-09-14
  • 来自专栏伟大程序猿的诞生

    Android自定义View【实战教程】1⃣️----attrs.xml详解

    定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference " /> </declare-styleable> 使用: <ImageView android:layout_width = "42dip" name = "名称"> <attr name = "focusable" format = "boolean" /> </declare-styleable> name = "名称"> <attr name = "layout_width" format = "dimension" /> </declare-styleable name = "名称"> <attr name = "background" format = "reference|color" /> </declare-styleable>

    75720发布于 2019-01-21
  • 来自专栏全栈程序员必看

    Attributable_文件属性里没有自定义

    (1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference" /> </declare-styleable (1)属性定义: <declare-styleable name = "名称"> <attr name = "textColor" format = "color" /> </declare-styleable (1)属性定义: <declare-styleable name = "名称"> <attr name = "focusable" format = "boolean" /> </declare-styleable (1)属性定义: <declare-styleable name = "名称"> <attr name = "layout_width" format = "dimension" /> </declare-styleable (1)属性定义: <declare-styleable name = "MapView"> <attr name = "apiKey" format = "string" /> </declare-styleable

    86540编辑于 2022-11-17
  • 来自专栏全栈程序员必看

    android中怎么在View构造的attrs中拿到android给的属性以及attrs属性介绍[通俗易懂]

    (1)属性定义: <declare-styleable name = "名称"> <attr name = "background" format = "reference" /> </declare-styleable (1)属性定义: <declare-styleable name = "名称"> <attr name = "textColor" format = "color" /> </declare-styleable (1)属性定义: <declare-styleable name = "名称"> <attr name = "focusable" format = "boolean" /> </declare-styleable (1)属性定义: <declare-styleable name = "名称"> <attr name = "layout_width" format = "dimension" /> </declare-styleable (1)属性定义: <declare-styleable name = "MapView"> <attr name = "apiKey" format = "string" /> </declare-styleable

    1.8K110编辑于 2022-11-02
  • 来自专栏Android知识分享

    手把手教你写一个完整的自定义View

    --在该集合下,设置不同的自定义属性--> <declare-styleable name="CircleView"> <! > </resources> 对于自定义属性类型 & 格式如下: <-- 1. reference:使用某一资源ID --> <declare-styleable name="名称"> <attr name="background" format="reference" /> </declare-styleable> // 使用格式 <ImageView android:layout_width name="名称"> <attr name="layout_width" format="dimension" /> </declare-styleable> // 格式使用: <Button android:apiKey="0jOkQ80oD1JL9C6HAja99uGXCRiS2CGjKO_bc_g" /> <-- 8. fraction:百分数 --> <declare-styleable

    2.1K20发布于 2019-02-22
  • 来自专栏Android知识分享

    Carson带你学Android:手把手教你写一个完整的自定义View

    --在该集合下,设置不同的自定义属性--> <declare-styleable name="CircleView"> <! > </resources> 对于自定义属性类型 & 格式如下: <-- 1. reference:使用某一资源ID --> <declare-styleable name="名称"> <attr name="background" format="reference" /> </declare-styleable> // 使用格式 <ImageView android:layout_width name="名称"> <attr name="layout_width" format="dimension" /> </declare-styleable> // 格式使用: <Button android:apiKey="0jOkQ80oD1JL9C6HAja99uGXCRiS2CGjKO_bc_g" /> <-- 8. fraction:百分数 --> <declare-styleable

    2.7K10编辑于 2022-03-24
  • 来自专栏有困难要上,没有困难创造困难也要上!

    Cordova 打包错误 ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVari

    问题描述 今天在使用 “cordova build android” 的时候,发现报下面的错误 ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings ERROR: In <declare-styleable> FontFamilyFont, unable ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex FAILURE: Build

    2.1K50发布于 2018-05-14
  • 来自专栏伟大程序猿的诞生

    安卓自定义View

    attr> <attr name="lineColor" format="color"></attr> //自定义控件的主题样式 //MySportView样式名称 <declare-styleable /attr> <attr name="outCircleColor"></attr> <attr name="inCircleColor"></attr> </declare-styleable > <declare-styleable name="MyQQHealthView"> <attr name="titleColor"></attr> <attr name="lineColor"></attr> </declare-styleable> </resources>

    58540发布于 2019-01-21
  • 来自专栏Eureka的技术时光轴

    Attribute "XXX" has already been defined

    先来看看第一种情况,这个好解决 : 只需将力哥styleable里的<atrr name="icon" /> ,并在资源的最外层定义<atrr name="icon" format="integer" /> <declare-styleable <enum name="normal" value="0"/> <enum name="mini" value="1"/> </attr> </declare-styleable > <declare-styleable name="B"> <attr name="colorPressed" format="color"/> <attr name= <enum name="normal" value="0"/> <enum name="mini" value="1"/> </attr> </declare-styleable

    1.5K10发布于 2019-07-24
  • 来自专栏刘晓杰

    用TypedArray给自定义控件配置属性

    当然是在values文件夹下新建attrs.xml <declare-styleable name="title"> <attr name="name" format="string "/> </declare-styleable> 生成TypedArray是用的declare-styleable的name,生成对应的string是在两个name中加下划线 用法 <com

    85520发布于 2019-02-21
  • 来自专栏学海无涯

    Android开发之自定义View(二)

    > <resources> <declare-styleable name="BoldTextView"> <attr name="textIsBlod" format="boolean " /> </declare-styleable> </resources> 2、创建一个类继承自TextView,很简单,内容都是前面讲过的 public class BoldTextView 1、自定义属性 <declare-styleable name="ImgBtn"> <attr name="imgbtn_title" format="string" /> <attr name="imgbtn_icon" format="reference" /> </declare-styleable> 2、组合控件布局 <LinearLayout xmlns:android

    90980发布于 2018-04-24
  • 来自专栏前端布道

    Ionic构建打包apk出现的问题集合

    FAILED Total time: 29.304 secs Error: cmd: Command failed with exit code 1 Error output: ERROR: In <declare-styleable > FontFamilyFont, unable to find attribute android:font ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontStyle ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontWeight ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute

    2.2K30发布于 2018-07-25
领券