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实现 最简单的一种办法就 ...
随机推荐
- Jvm远程监控
服务器运行新建文件 : udi.policy grant codebase "file:${java.home}/../lib/tools.jar" { permission ja ...
- LDAP学习笔记总结
一.LDAP概念LDAP是轻量目录访问协议,英文全称是Lightweight Directory Access Protocol,一般都简称为LDAP.它是基于X.500标准的,但是简单多了并且可以根 ...
- PHP从入门到精通(一)
(一)PHP简介和基本知识 PHP(外文名:PHP: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言.语法吸收了C语言.Java和Perl的特点,利于 ...
- react/React Native 在 import 导入时,有的带花括号{},有的不带原理解析
在使用import引用模块时,如何正确使用{} 例如:有两个文件,home.js.user.js 一:不使用{}: 当需要在home.js中引入user.js的时候 //home.js 文件中impo ...
- box-flex 弹性合布局+WebApp布局自适应
问:随着屏幕改变,中间自适应 两边固定宽度? 参考: nec 布局 四种方法--博客园 问:左侧导航栏隐藏后,右侧内容宽度自动(响应式)变大? <!DOCTYPE html> <ht ...
- 898 C. Phone Numbers
传送门 [http://codeforces.com/contest/898/problem/C] 题意 题意比较难理解直接看样例就知道了,给你个n接下来n行,每行包括一个名字和号码的数量,还有具体的 ...
- 研究C语言的新型编译环境TCC
C语言综合研究1 搭建一个tcc环境 研究过程: 问题引出:为什么要使用tcc环境,甚至连图形界面都没有,为什么要使用这样的化境? 按照我们学习的本质来讲,可能是为了体验C语言底层的相关特性,但是在研 ...
- JAVA链表中迭代器的实现
注:本文代码出自<java数据结构和算法>一书. PS:本文中类的名字定义存在问题,Link9应改为Link.LinkList9应该为LinkList.由于在同包下存在该名称,所以在后面接 ...
- jdbcTemplete(转)
文章来源:http://blog.csdn.net/dyllove98/article/details/7772463 JdbcTemplate主要提供以下五类方法: execute方法:可以用于执行 ...
- ShowHand
实验目的: Github基本源代码控制方法 利用Junit4进行程序模块的测试,回归测试 编码规范的考量 C/Java等基本程序设计语言的运用. 实验过程: import java.util.Arra ...