本文介绍了单选按钮,顶部的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你怎么做一个单选按钮,你改变绘制与Android:按钮,并有顶部的文本?与常规单选按钮文本的后面绘制分层。
现在,我开始在一个失意的实现我自己的单选框脱身。
我想是这样的:
< RadioGroup中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:方向=横向>
<单选
机器人:文字=东西是在上面
机器人:ID =@ + ID / toggle_tab_left
机器人:按钮=@绘制/ main_selector
风格=@风格/ TabStyle/>
<单选
机器人:按钮=@绘制/ info_selector
机器人:文字=东西是在上面
机器人:ID =@ + ID / toggle_tab_right
风格=@风格/ TabStyle/>
< / RadioGroup中>
解决方案
您可以使用背景
属性为图形代替,并设置按钮
来@null或透明色。
How do you make a radiobutton where you change the drawable with android:button and have text on top? with regular radio buttons the text is layered behind the drawable.
Right now I'm starting to get out in a frustrated implementation of my own radiobutton.
I want something like this:
<RadioGroup xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RadioButton
android:text="something that is on top"
android:id="@+id/toggle_tab_left"
android:button="@drawable/main_selector"
style="@style/TabStyle"/>
<RadioButton
android:button="@drawable/info_selector"
android:text="something that is on top"
android:id="@+id/toggle_tab_right"
style="@style/TabStyle"/>
</RadioGroup>
解决方案
You can use the background
attribute for the graphic instead, and set the button
to @null or a transparent color.
这篇关于单选按钮,顶部的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!