Android Checkbox Example】的更多相关文章

xamarin android checkbox自定义样式 在drawable文件在新建checkbox_bg.xml文件 <?xml version="1.0" encoding="utf-8" ?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable…
http://www.beijibear.com/index.php?aid=336 android CheckBox控件的定义及事件监听,本例实现CheckBox控件的定义及点击事件的监听并显示结果,运行效果截图如下: CheckBox控件的定义,main.xml内容如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas…
CheckBox定义一个同意协议的按钮,只要同意button才可以点击 XML代码 <CheckBox android:id="@+id/checkbox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/button1" android:layout_alignLef…
安卓默认的效果                         自定义后的效果 前面的图片当然可以自己修改. 实现这个效果的步骤如下 1.建立 一个selector 的xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android…
1. Custom String 打开 “res/values/strings.xml” 文件, File : res/values/strings.xml <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">CheckBoxDemo</string> <string name="act…
checkBox      状态:选中(true),未选中(false)      属性:           checked="true/false"; private CheckBox  checkbox ;         @Override         protected void onCreate(Bundle savedInstanceState) {                super.onCreate(savedInstanceState);         …
package com.example.radiobutton_01; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.Toast; publi…
利用自身的定义CheckBox 要么RadioButton时间.定义自己的图标和文字在不同的手机显示不同的音高.有时不太好控制,下面是我自己的定义CheckBox: 在Layout在下面xml: <CheckBox android:id="@+id/recharge_activity_cb" style="@style/CustomCheckboxTheme" android:layout_width="wrap_content" andr…
效果图: 未选中状态: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt=""> 选中状态: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/d…
<CheckBox  android:id="@+id/cb1"  android:layout_width="fill_parent"  android:layout_height="wrap_content"  android:text="CheckBox1" /> //实例化 CheckBox cb1 = (CheckBox) findViewById(R.id.cb1); cb1.setOnCheckedC…
CheckBox修改大小: android:scaleX="0.8" android:scaleY="0.8" CheckBox修改边框颜色,注意不是背景色: android:buttonTint="@color/colorAccent" 修改大小和边框颜色: <CheckBox android:layout_width="wrap_content" android:layout_height="match_p…
第一种:在原生中只调整显示位置等: <CheckBox android:id="@+id/checkBox8" android:layout_width="wrap_content" android:layout_height="wrap_content" android:button="@null" //这个很重要,必须null android:drawableBottom="?android:attr/li…
1. 首先要导入你准备用作CheckBox选中和补选中状态的两图片到res的drawable中,如checkbox_checked.png,checkbox_normal.png: 2. 在res/drawable中添加checkbox.xml,定义checkbox的state list drawable图片 <?xml version="1.0" encoding="UTF-8"?> <selector xmlns:android="h…
关键是: android:scaleX="0.5" <CheckBox android:id="@+id/checkBox1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="是" android:scaleX="0.7" android:scaleY=&q…
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBott…
1.在xml文件中定义CheckBox,一定要定义id <CheckBox android:id="@+id/beijing" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="北京" /> 2.在对应的Java文件中声明对象并赋值 //对控件对象进行声明 CheckBox beijing=n…
checkView.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if(((CheckBox)v).isSelected()){ checkView.setChecked(false); checkView.setSelected(false); }else{ if(mCheckData.size()>=5)…
代码中动态设置checkBox的文字选中背景和未选中背景,用如下代码: checkView.setTextColor(getResources().getColor(R.color.item_color));设置后点击无效, 改为如下: ColorStateList mTextColor =  (ColorStateList) context.getResources().getColorStateList(R.color.item_color); if(mTextColor!=null){ c…
\n换行 UI visible:View.INVISIBLE 不可见,占用空间,View.GONE  不可见,不占用空间 菜单 res右击新建menu xml 自动新建menu文件夹 context menu 如果以上items不定义诚final,在showLD执行完后,items也消失了,这个时候items[which]就访问不到了,定义成final,它就不会随着方法的消失而消失 dialog中插入自定义的view .show()…
shape和selector的结合使用 (2013-04-07 11:11:00) 转载▼   分类: android 1.Shape (1)作用:XML中定义的几何形状 (2)位置:res/drawable/文件的名称.xml (3)使用的方法: Java代码中:R.drawable.文件的名称 XML中:Android:background="@drawable/文件的名称" (4)shape 属性: <shape> Android:shape=["recta…
[Building and using plug-ins for Android] 1.AAR plug-ins and Android Libraries Android Archive (AAR) plug-ins are bundles that include compiled Java and native (C/C++) code, resources, and an Android Manifest. The .aar file itself is a zip archive wh…
字符串资源文件strings.xml: <resources> <string name="hello">主类main</string> <string name="app_name">选项</string> <string name="music">音乐</string> <string name="sing">唱歌</st…
该工程的功能实现在一个activity中显示一个单选框和一个多选框 以下代码是MainActivity.java文件中的代码 package com.example.checkbox; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.CheckBox; import android…
转自:http://yangshen998.iteye.com/blog/1310183 在Android某些开发需求当中,有时候需要在listveiw中加入checkbox实现单选,多选操作.表面上看上去只是改变checkbox那么简单,然而实际开发中,实现起来并不是那么得心应手.尤其当listview比较多(比如屏幕最多只能显示10个item,但总共有12个item,也就是说listview的item数大于屏幕能够显示的item数)滑动屏幕的时候,由于适配器中getview()会重复使用被移…
3.4 EditText EditText类官方文档地址:http://developer.android.com/reference/android/widget/EditText.html EditText继承TextView,所以EditText具有TextView的属性特点,下面主要介绍一些EditText的特有的输入法的属性特点android:layout_gravity="center_vertical":设置控件显示的位置:默认top,这里居中显示,还有bottomand…
ListView实现的列表,如果是可编辑,可删除的,一般都要提供批量删除功能,否则的话,一项一项的删除体验很不好,也给用户带来了很大的麻烦. 实现效果图 具体实现代码 select.xml 主布局文件包含一个ListView还有一个隐藏的布局,包含了两个Button一个TextView,默认布局为gone,当监听到长按响应事件时候显示. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xml…
单选按钮和复选框在实际中经常看到,今天就简单梳理下. 首先,我们在工具中拖进单选按钮RadioGroup和复选框Checkbox,如图: xml对应的源码: <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="…
activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" a…
xiazai_checkbox.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > <item android:state_selected="true" android:drawable="@drawable/h…
由于listview的一些特性,刚开始写这种需求的功能的时候都会碰到一些问题,重点就是存储每个checkbox的状态值,在这里分享出了完美解决方法:     布局文件: [html]   <?xml version="1.0" encoding="utf-8"?>   <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"      …