Android设置RadioButton在文字的右边
效果图如下:

- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
- <TextView
- android:id="@+id/radiobutton_textview"
- android:layout_width="fill_parent"
- android:layout_height="50dip"
- android:background="@android:drawable/title_bar"
- android:gravity="center_vertical"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textSize="18dip"
- android:textStyle="bold" />
- <RadioGroup
- android:id="@+id/group"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical" >
- <RadioButton
- android:id="@+id/button1"
- android:layout_width="fill_parent"
- android:layout_height="50dip"
- android:button="@null"
- android:drawableRight="@android:drawable/btn_radio"
- android:paddingLeft="30dip"
- android:text="Android新手"
- android:textSize="20dip" />
- <View
- android:layout_width="fill_parent"
- android:layout_height="1px"
- android:background="?android:attr/listDivider" />
- <RadioButton
- android:id="@+id/button2"
- android:layout_width="fill_parent"
- android:layout_height="50dip"
- android:button="@null"
- android:drawableRight="@android:drawable/btn_radio"
- android:paddingLeft="30dip"
- android:text="Android高手"
- android:textSize="20dip" />
- </RadioGroup>
- </LinearLayout>
- package sdfasdf.sadf;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.RadioGroup;
- import android.widget.RadioGroup.OnCheckedChangeListener;
- import android.widget.TextView;
- public class SdfsadfasdfasdffActivity extends Activity {
- private TextView textView;
- private RadioGroup group;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- textView = (TextView) findViewById(R.id.radiobutton_textview);
- group = (RadioGroup) findViewById(R.id.group);
- // 单选按钮组监听事件
- group.setOnCheckedChangeListener(new OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(RadioGroup group, int checkedId) {
- // 根据ID判断选择的按钮
- if (checkedId == R.id.button1) {
- textView.setText("Android新手");
- } else {
- textView.setText("Android高手");
- }
- }
- });
- }
- }
http://blog.csdn.net/furongkang/article/details/7272512
Android设置RadioButton在文字的右边的更多相关文章
- Android中如何设置RadioButton在文字的右边,图标在左边
from:http://blog.csdn.net/sunnyfans/article/details/7901592?utm_source=tuicool&utm_medium=referr ...
- android自定义radiobutton样式文字颜色随选中状态而改变
主要是写一个 color selector 在res/建一个文件夹取名color res/color/color_radiobutton.xml <selector xmlns:android= ...
- Android 自定义RadioButton实现
由于使用小米系统MIUI运行是RadioButton样式跟google Android API自定义的不一样,则我们可以定义任何想要的东东.没有做不到,只有想不到 Android 自定义RadioBu ...
- Android中代码设置RadioButton的高端技巧
不知道怎么起标题,就这样了. 目前主要讲两个方面内容: 代码方式 设置RadioButton的 android:button . android:background 等属性为 @null : 代码方 ...
- 【Android初级】使用TypeFace设置TextView的文字字体(附源码)
在Android里面设置一个TextView的文字颜色和文字大小,都很简单,也是一个常用的基本功能.但很少有设置文字字体的,今天要分享的是通过TypeFace去设置TextView的文字字体,布局里面 ...
- 转:android 自定义RadioButton样式
http://gundumw100.iteye.com/blog/1146527 上面这种3选1的效果如何做呢?用代码写? 其实有更简单的办法,忘了RadioButton有什么特性了吗? 我就用Ra ...
- 改变RadioButton的文字位置以及距离
在默认情况下,RadioButton的 文字位置和文字的距离是不变的,为了可以改变它,我们可以用以下的方法. 1.改变文字的位置 android:button="@null" // ...
- Android 自定义RadioButton样式
上面这种3选1的效果如何做呢?用代码写? 其实有更简单的办法,忘了RadioButton有什么特性了吗? 我就用RadioButton实现了如上效果,其实很简单的. 首先定义一张background ...
- Android实现自定义带文字和图片的Button
Android实现自定义带文字和图片的Button 在Android开发中经常会需要用到带文字和图片的button,下面来讲解一下常用的实现办法. 一.用系统自带的Button实现 最简单的一种办法就 ...
随机推荐
- 关于Prometheus运维实践项目
关于Promethues运维实践项目 1. 什么是Prometheus运维实践项目 是什么 Prometheus,普罗米修斯,是古希腊神话中为人间带来火种的神. Prometheus运维实 ...
- 2018年计划小里程碑(6月)PMI-ACP 敏捷
年初定的计划之一,考证... 7A,意料之外,也是意料之中.历时两个月多,2018.3.31号决定报名,顶着压报了ACP+ACP实战+PMP,考虑了下敏捷是未来项目管理的趋势,大部分公司正在向敏捷转型 ...
- Ionic 2 中生命周期的命名改变及说明
原文发表于我的技术博客 本文简要整理了在 Ionic 2 的版本中生命周期命名的改变,以及各个事件的解释. 原文发表于我的技术博客 在之前的课程中讲解了 Ionic 生命周期的命名以及使用,不过在 I ...
- Docker容器学习梳理 - 日常操作总结
使用Docker已有一段时间了,今天正好有空梳理下自己平时操作Docker时的一些命令和注意细节: Docker 命令帮助 $ sudo docker Commands: attach Attach ...
- last individual reading task 12061183叶露婷
http://www.cnblogs.com/yltyy/p/4025426.html 1.Different people deserve different tasks; Once team ro ...
- SQLserver 进程被死锁问题解决
事务(进程ID xx)与另一个进程被死锁在 锁|通信缓冲区 资源上,并且已被选座死锁牺牲品.请重新运行该事务.Sqlserver 当出现这个错误时,如下图: 解决办法:更改数据库事务隔离级别 alte ...
- 通过LVM给Linux扩容
主要参考以下两篇文章: 1:https://www.cnblogs.com/sixiweb/p/3360008.html 2:https://wenku.baidu.com/view/42deee1a ...
- java中实现全局变量的功能
一.通过接口实现 二.通过静态变量 static声明 package test.autorun; import java.util.LinkedList; import java.util.Queu ...
- Linux虚拟机下与主机通信
1.更改虚拟机ip和主机ip同一网段 2.配置虚拟机的网络适配器 3.主机进行ping测试
- [日常工作]GS使用安装盘修改密码后的处理
1. GS服务器端有时候需要修改 9999 的用户密码.但是修改完密码之后有几个注意事项: 一般有两个可以修改注册的地方: 使用setup里面的修改用户密码 修改完密码之后要手工注册一下数据库实例 也 ...