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实现 最简单的一种办法就 ...
随机推荐
- Java中clone的写法
Cloneable这个接口设计得十分奇葩,不符合正常人的使用习惯,然而用这个接口的人很多也很有必要,所以还是有必要了解一下这套扭曲的机制.以下内容来自于对Effective Java ed 2. it ...
- go陷阱
必看的题目:https://blog.csdn.net/weiyuefei/article/details/77963810 1.关于值传递.引用传递与指针传递 当一个变量或者新值被创建时, 如果没有 ...
- 10 分钟理解 BFC 原理
一.常见定位方案 在讲 BFC 之前,我们先来了解一下常见的定位方案,定位方案是控制元素的布局,有三种常见方案: 普通流 (normal flow) 在普通流中,元素按照其在 HTML 中的先后位置至 ...
- Individual P1: Summary
经过5个小时成功把simple mode写差不多了..orz 也是蛮拼的. 开始毫无头绪,本能地开始从度娘搜索‘c# 单词统计’= =看了两段代码也算是见过c#的人了.差不多花了我1小时的时间. 然后 ...
- 【Beta阶段】第七次Scrum Meeting!
每日任务内容: 本次会议为第七次Scrum Meeting会议~ 由于本次会议项目经理召开时间为10:00,在宿舍召开,召开时长约20分钟. 队员 昨日完成任务 明日要完成任务 刘乾 #177(未完成 ...
- 个人github链接及git学习心得总结
个人github链接 https://www.github.com/liangjianming/test git学习心得总结 git是一个快速,开源,分布式的版本控制系统. GitHub是一个基于w ...
- [转帖]数据中心网络里的Underlay和Overlay
数据中心网络里的Underlay和Overlay https://blog.csdn.net/zjc801blog/article/details/54289683 2017年01月09日 15:47 ...
- [自学]Docker system 命令 查看docker镜像磁盘占用情况 Docker volume 相关
内容From https://docs.docker.com/engine/reference/commandline/system_df/ docker的image和docker的container ...
- java面向对象的核心思想
java面向对象的特征之一:封装 1.封装性的使用 package edu.tongji.classdemo; /* 封装性 1.封装的目的:保护某些属性和方法不被外部所见 2.封装的实现 为属性和方 ...
- 归并排序详解(python实现)
因为上个星期leetcode的一道题(Median of Two Sorted Arrays)所以想仔细了解一下归并排序的实现. 还是先阐述一下排序思路: 首先归并排序使用了二分法,归根到底的思想还是 ...