各位大哥大姐 请教下这是什么类型按钮? 这按钮功能跟单选按钮一样 最终只能选一个 小弟新手 不知道这是自定义做的按钮 还是说有插件可以实现这样? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 做2张图片,一张是左边那种亮色的图片A,一张是右边那种灰度的图片B定义2个按钮,默认的时候第一按钮的背景为图片A,第2个按钮的背景为图片B,当点击第2个按钮的时候,将第1个按钮背景改为图片B,第2个按钮改为图片A,以此类推即可。 也可以是单选按钮RadioButton,将样式重新定义一下就行了 Button 和 ImageButton 都可以实现的,自定义按钮的background 你好问下 我在按钮的事件里设置了 点中的文字颜色变白色 但为什么我一点 结果3个按钮的颜色都变灰色 请问知道是什么情况吗..看代码- -真不知道哪里设置错了 以下就是设置颜色的代码rdoLeft.setTextColor(R.color.white);rdoCenter.setTextColor(R.color.gray);rdoRight.setTextColor(R.color.gray); 这个你把事件那一块一点的代码贴出来看看用自定义的RadioButton处理会简单一点布局如下:<RadioGroup android:id="@+id/rg" android:layout_width="fill_parent" android:layout_height="50px" android:background="#f00" android:orientation="horizontal" > <RadioButton android:id="@+id/rb01" style="@style/menu_item" android:checked="true" android:drawableTop="@drawable/menu_home" android:text="主页" /> <RadioButton android:id="@+id/rb02" style="@style/menu_item" android:drawableTop="@drawable/menu_clear" android:text="清除" /> <RadioButton android:id="@+id/rb03" style="@style/menu_item" android:drawableTop="@drawable/menu_refresh" android:text="刷新" /> <RadioButton android:id="@+id/rb04" style="@style/menu_item" android:drawableTop="@drawable/menu_save" android:text="保存" /> <RadioButton android:id="@+id/rb05" style="@style/menu_item" android:drawableTop="@drawable/menu_more" android:text="更多" /> </RadioGroup>menu_item这个是自定义的样式,在style.xml文件里面如下定义:<style name="menu_item"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">fill_parent</item> <item name="android:button">@null</item> <item name="android:gravity">center_horizontal</item> <item name="android:background">@drawable/menu_item_bg</item> <item name="android:layout_weight">1</item> </style>具体的代码可以参考这个 http://www.iteye.com/topic/1118818 【求助】更改系统设置选项,控制APK的溢出菜单按钮 sqlite查询问题 android socket如何建立一个SOCK_RAW? android中的res添加资源,但是在R类却显示不出来 求解!!!! 关于实现发送带有表情的文字的问题 Android界面分层布局问题 android开发 onScroll不是每次都被调用,求高手支招 Android平台 机器机身rom测试工具 android 用模拟器 启动4.4.2的系统 起不来 用android来实现图片轮播 关于更新方式,这两种效果大概是如何实现的?
请问知道是什么情况吗..看代码- -真不知道哪里设置错了 以下就是设置颜色的代码
rdoLeft.setTextColor(R.color.white);
rdoCenter.setTextColor(R.color.gray);
rdoRight.setTextColor(R.color.gray);
这个你把事件那一块一点的代码贴出来看看用自定义的RadioButton处理会简单一点布局如下:<RadioGroup
android:id="@+id/rg"
android:layout_width="fill_parent"
android:layout_height="50px"
android:background="#f00"
android:orientation="horizontal" > <RadioButton
android:id="@+id/rb01"
style="@style/menu_item"
android:checked="true"
android:drawableTop="@drawable/menu_home"
android:text="主页" /> <RadioButton
android:id="@+id/rb02"
style="@style/menu_item"
android:drawableTop="@drawable/menu_clear"
android:text="清除" /> <RadioButton
android:id="@+id/rb03"
style="@style/menu_item"
android:drawableTop="@drawable/menu_refresh"
android:text="刷新" /> <RadioButton
android:id="@+id/rb04"
style="@style/menu_item"
android:drawableTop="@drawable/menu_save"
android:text="保存" /> <RadioButton
android:id="@+id/rb05"
style="@style/menu_item"
android:drawableTop="@drawable/menu_more"
android:text="更多" />
</RadioGroup>
menu_item这个是自定义的样式,在style.xml文件里面如下定义:<style name="menu_item">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:button">@null</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:background">@drawable/menu_item_bg</item>
<item name="android:layout_weight">1</item>
</style>
具体的代码可以参考这个 http://www.iteye.com/topic/1118818