如何对多个按钮统一设置属性? 我有差不多10个控件,但是我想把这十个都统一设置背景颜色。 如果是一个一个设置的话会很麻烦,不知道大家 是怎么弄这个问题的呢?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 android res/values/styles.xml文件可以定义统一的样式比如 styles.xml代码如下: <style name="backgroundformyapp"> <item name="android:background">背景</item> </style>布局文件中的控件引用,比如ImageView,Button设置背景 <ImageView style="@style/backgroundformyapp" /> <Button style="@style/backgroundformyapp" /> 你没有自定义过控件吗?定义过啊,在布局文件 <Button android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/A01ID" android:text="@string/A1Text" />这种还不算吗? 你没有自定义过控件吗?定义过啊,在布局文件 <Button android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/A01ID" android:text="@string/A1Text" />这种还不算吗?不算,我说的是重写button这个类,统一设置背景色.类似于这个 <com.test.ButtonTest android:layout_weight="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/A01ID" android:text="@string/A1Text" />如果只是单一的改变背景色,用2楼的方法就行了.. 这种貌似还是不行啊, <Button style="@style/backgroundformyapp" />你这个还是需要 单个设置Button的背景啊。。我想问的是全部Button控件统一设置就是只要设置一次,就所有的控件都变成统一的背景的那种谢谢。。 这种貌似还是不行啊, <Button style="@style/backgroundformyapp" />你这个还是需要 单个设置Button的背景啊。。我想问的是全部Button控件统一设置就是只要设置一次,就所有的控件都变成统一的背景的那种谢谢。。那你从写android的Button类,重新设置背景就可以了。 android 智能检索联系人 做过的朋友进 静待达人 有关屏幕自适应 请问android2.3.3系统,如何完全退出程序! 请问所有xml中都有的这一行是什么意思? 如何通过android模拟器从android market上下载软件 android 输入法问题 在线等待求解 在线求助一个关于时钟设计的问题! 请问给位大神,我想问问有什么音频开源库可以实现男声变女声并且可以应用到android上的?请大神们为我解答一下可以?谢谢大家 江湖救急小白。安卓studio。 急需帮助 有大神在吗,在XML中对RelativeLayout设置onClick,然后报错 android播放器怎么调用硬解
比如 styles.xml代码如下:
<style name="backgroundformyapp">
<item name="android:background">背景</item>
</style>
布局文件中的控件引用,比如ImageView,Button设置背景
<ImageView style="@style/backgroundformyapp" />
<Button style="@style/backgroundformyapp" />
定义过啊,在布局文件 <Button
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/A01ID"
android:text="@string/A1Text"
/>这种还不算吗?
定义过啊,在布局文件 <Button
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/A01ID"
android:text="@string/A1Text"
/>这种还不算吗?不算,我说的是重写button这个类,统一设置背景色.类似于这个
<com.test.ButtonTest
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/A01ID"
android:text="@string/A1Text"
/>
如果只是单一的改变背景色,用2楼的方法就行了..
<Button style="@style/backgroundformyapp" />
你这个还是需要 单个设置Button的背景啊。。
我想问的是全部Button控件统一设置
就是只要设置一次,就所有的控件都变成统一的背景的那种
谢谢。。
<Button style="@style/backgroundformyapp" />
你这个还是需要 单个设置Button的背景啊。。
我想问的是全部Button控件统一设置
就是只要设置一次,就所有的控件都变成统一的背景的那种
谢谢。。那你从写android的Button类,重新设置背景就可以了。