Android如何多个控件设置一个属性

2025-03-17 22:16:59
推荐回答(5个)
回答1:

通过设置公共style的方式对同一个属性进行统一设置

1、res/values文件夹下新建一个xml文件



    
    
       
        #1A4EA4  
    

2、组件中使用

        android:text="自定义样式一" android:layout_height="wrap_content" style="@style/et1">  

回答2:

给Button设置一个style属性,这个style引用
自己定义的style
将要设置的相同的属性都写在style里,这个style是要自己定义的,style文件的写法比如
name="android:width">wrap_content
name="android:height">match_parent

回答3:

给Button设置一个style属性,这个style引用 自己定义的style

将要设置的相同的属性都写在style里,这个style是要自己定义的,style文件的写法比如

回答4:

直接写道res/values/目录下就行了
语法


text_string

回答5:

style 里面 然后把styleID付给你的button