当前位置: 首页 > news >正文

网站建设需求信息建筑工程公司注册需要什么条件

网站建设需求信息,建筑工程公司注册需要什么条件,沪尚茗居官网上海,网站开发招标书一、RadioButton#xff08;单选按钮#xff09; 1.1、简介 RadioButton表示单选按钮#xff0c;是button的子类#xff0c;每一个按钮都有选择和未选中两种状态#xff0c;经常与RadioGroup一起使用#xff0c;否则不能实现其单选功能。RadioGroup继承自LinearLayout单选按钮 1.1、简介 RadioButton表示单选按钮是button的子类每一个按钮都有选择和未选中两种状态经常与RadioGroup一起使用否则不能实现其单选功能。RadioGroup继承自LinearLayout可以使用Orientation属性控制RadioButton的排列方向。单项选择相信大家都不陌生吧。Android平台也提供了单项选择的组件可以通过RadioGroup、RadioButton组合起来完成一个单项选择的效果。 1.2、基本用法与事件处理 如题单选按钮就是只能够选中一个所以我们需要把RadioButton放到RadioGroup按钮组中从而实现 单选功能先熟悉下如何使用RadioButton一个简单的性别选择的例子 另外我们可以为外层RadioGroup设置orientation属性然后设置RadioButton的排列方式是竖直android:orientationvertical还是水平android:orientationhorizontal 1.2.1、获得选中的值有四种方式 1、为RadioButton在xml中设置一个事件监听器 XML RadioGroupandroid:idid/rg1android:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:orientationverticalRadioButtonandroid:idid/radiobutton1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:onClickbtnRadioButton1android:text男android:textSize30dp/RadioButtonandroid:idid/radiobutton2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:onClickbtnRadioButton2android:text女android:textSize30dp/ /RadioGroup Activity public class MainActivity extends AppCompatActivity {private RadioButton radioButton1;private RadioButton radioButton2;private TextView textView;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_view_main);radioButton1 findViewById(R.id.radiobutton1);radioButton2 findViewById(R.id.radiobutton2);textView findViewById(R.id.textview);}public void btnRadioButton1(View view) {textView.setText(您的性别为男);}public void btnRadioButton2(View view) {textView.setText(您的性别为女);} } 效果图 2、为RadioButton设置一个事件监听器setOnCheckChangeListener XML LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalTextViewandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:text请选择性别android:textSize20spandroid:textStyleboldandroid:layout_margin10dp/RadioGroupandroid:idid/radiogroupandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:orientationverticalRadioButtonandroid:idid/radiobutton1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text男android:textSize30dp/RadioButtonandroid:idid/radiobutton2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text女android:textSize30dp//RadioGroupTextViewandroid:idid/textviewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textColorcolor/redandroid:layout_margin10dpandroid:textSize18sp//LinearLayout Activity public class MainActivity extends AppCompatActivity {private RadioGroup mBtnRadioGroup;private TextView textView;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_view_main);mBtnRadioGroup findViewById(R.id.radiogroup);textView findViewById(R.id.textview);mBtnRadioGroup.setOnCheckedChangeListener(new         RadioGroup.OnCheckedChangeListener() {Overridepublic void onCheckedChanged(RadioGroup group, int checkedId) {RadioButton radbtn findViewById(checkedId);textView.setText(按钮组值发生改变,你选了 radbtn.getText());}});} } 效果图 注意另外有一点要切记要为每个RadioButton添加一个id不然单选功能会生效 3、是判断被点击的id是哪一个单选按钮的id通过id去获取值 XML与效果图同上 Activity public class MainActivity extends AppCompatActivity {private RadioGroup mBtnRadioGroup;private TextView textView;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_view_main);mBtnRadioGroup findViewById(R.id.radiogroup);textView findViewById(R.id.textview);mBtnRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {Overridepublic void onCheckedChanged(RadioGroup group, int checkedId) {switch (checkedId) {case R.id.radiobutton1:textView.setText(按钮组值发生改变,你选了男);break;case R.id.radiobutton2:textView.setText(按钮组值发生改变,你选了女);break;default:break;}}});} } 4、是通过单击其他按钮获取选中单选按钮的值当然我们也可以直接获取这个看需求~ XML: LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalTextViewandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:text请选择性别android:textSize20spandroid:textStyleboldandroid:layout_margin10dp/RadioGroupandroid:idid/radiogroupandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:orientationverticalRadioButtonandroid:idid/radiobutton1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text男android:textSize30dp/RadioButtonandroid:idid/radiobutton2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text女android:textSize30dp//RadioGroupTextViewandroid:idid/textviewandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:textColorcolor/redandroid:layout_margin10dpandroid:textSize18sp/Buttonandroid:idid/btn_sumitandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_marginStart33dpandroid:layout_marginTop114dpandroid:paddingStart50dpandroid:paddingEnd50dpandroid:paddingTop10dpandroid:paddingBottom10dpandroid:text提交android:textSize18sp//LinearLayout Activity: public class MainActivity extends AppCompatActivity {private RadioGroup mBtnRadioGroup;private TextView textView;private Button mBtnSumit;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_view_main);mBtnRadioGroup findViewById(R.id.radiogroup);mBtnSumit findViewById(R.id.btn_sumit);textView findViewById(R.id.textview);mBtnSumit.setOnClickListener(new View.OnClickListener() {Overridepublic void onClick(View v) {for (int i 0; i mBtnRadioGroup.getChildCount(); i) {RadioButton rd (RadioButton) mBtnRadioGroup.getChildAt(i);if (rd.isChecked()) {textView.setText(点击提交按钮,获取你选择的是: rd.getText());break;}}}});} } 效果图 代码解析 这里我们为提交按钮设置了一个setOnClickListener事件监听器,每次点击的话遍历一次RadioGroup判断哪个按钮被选中我们可以通过下述方法获得RadioButton的相关信息。 getChildCount( )获得按钮组中的单选按钮的数目getChinldAt(i):根据索引值获取我们的单选按钮isChecked( ):判断按钮是否选中 二、Checkbox复选框 2.1、简介 CheckBox一般用来提供给用户输入信息的组件,可以一次选择多个选项.这个组件解决了不是很方便的手机屏幕操作输入时.用选择组件供用户单击输入选项,显得非常有用。它是Button的子类用于实现多选功能。每个复选框都有“选中”和“未选中”两种状态这两种状态时通过andorid:checked属性指定的当该属性的值为true时表示选中状态。 2.2、示例 效果图 XML ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationverticalTextViewandroid:idid/textView_headandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text请选择你的爱好android:textStyleboldandroid:textSize19dp/CheckBoxandroid:idid/checkBox1android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text游泳 /CheckBoxandroid:idid/checkBox2android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text魔方 /CheckBoxandroid:idid/checkBox3android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text卡林巴 /CheckBoxandroid:idid/checkBox4android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text编程 /TextViewandroid:idid/textView_endandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:text你选择的爱好是android:textStyleboldandroid:textSize17dp/ /LinearLayoutActivity public class MainActivity extends AppCompatActivity implements CompoundButton.OnCheckedChangeListener {private TextView mTextViewEnd;private CheckBox mCheckBox01, mCheckBox02, mCheckBox03, mCheckBox04;private String checkString ;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_view_main);mTextViewEnd findViewById(R.id.textView_end);mCheckBox01 findViewById(R.id.checkBox1);mCheckBox02 findViewById(R.id.checkBox2);mCheckBox03 findViewById(R.id.checkBox3);mCheckBox04 findViewById(R.id.checkBox4);checkString 你选择的爱好有;mCheckBox01.setOnCheckedChangeListener(this);mCheckBox02.setOnCheckedChangeListener(this);mCheckBox03.setOnCheckedChangeListener(this);mCheckBox04.setOnCheckedChangeListener(this);}Overridepublic void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {String hobby buttonView.getText().toString();if (isChecked) {if (!checkString.contains(hobby)) {checkString hobby;mTextViewEnd.setText(checkString);}} else {if (checkString.contains(hobby)) {checkString checkString.replace(hobby, );mTextViewEnd.setText(checkString);}}} } 同样 复选框即可以同时选中多个选项至于获得选中的值同样有三种方式 1.为每个CheckBox添加事件setOnCheckedChangeListener 2.弄一个按钮在点击后对每个checkbox进行判断:isChecked() 3.对选中的按钮id进行判断。 2.3、自定义点击效果 虽然5.0后的RadioButton和Checkbox都比旧版本稍微好看了点但是对于我们来说 可能还是不喜欢或者需求需要自己点击效果实现起来很简单先编写一个自定义 的selctor资源设置选中与没选中时的切换图片~ 效果图 自定义复选框选中与未选中背景资源rad_btn_selctor ?xml version1.0 encodingutf-8? selector xmlns:androidhttp://schemas.android.com/apk/res/android     item         android:state_enabledtrue         android:state_checkedtrue         android:drawablemipmap/ic_checkbox_checked/     item         android:state_enabledtrue         android:state_checkedfalse         android:drawablemipmap/ic_checkbox_normal / /selector 写好后我们有两种方法设置也可以说一种吧你看看就知道了~ ①android:button属性设置为上述的selctor android:buttondrawable/rad_btn_selctor ②在style中定义一个属性然后通过android style属性设置先往style添加下述代码 style nameMyCheckBox parentandroid:style/Widget.CompoundButton.CheckBox     item nameandroid:buttondrawable/rad_btn_selctor/item /style 最后布局那里: stylestyle/MyCheckBox   2.4、改变文字与选择框的相对位置 这个实现起来也很简单还记得我们之前学TextView的时候用到的drawableXxx吗 要控制选择框的位置两部即可设置 Step 1. android:buttonnullStep 2. android:drawableTopandroid:drawable/btn_radio 当然我们可以把drawableXxx替换成自己喜欢的效果 2.5、修改文字与选择框的距离 有时我们可能需要调节文字与选择框之间的距离让他们看起来稍微没那么挤我们可以 1.在XML代码中控制 使用android:paddingXxx “xxx” 来控制距离 2.在Java代码中稍微好一点动态计算paddingLeft! rb.setButtonDrawable(R.drawable.rad_btn_selctor); int rb_paddingLeft getResources().getDrawable(R.mipmap.ic_checkbox_checked).getIntrinsicWidth()5;  rb.setPadding(rb_paddingLeft, 0, 0, 0);
文章转载自:
http://www.morning.yhsrp.cn.gov.cn.yhsrp.cn
http://www.morning.hpxxq.cn.gov.cn.hpxxq.cn
http://www.morning.krqhw.cn.gov.cn.krqhw.cn
http://www.morning.kszkm.cn.gov.cn.kszkm.cn
http://www.morning.wnjrf.cn.gov.cn.wnjrf.cn
http://www.morning.tdhxp.cn.gov.cn.tdhxp.cn
http://www.morning.gtmdq.cn.gov.cn.gtmdq.cn
http://www.morning.sltfk.cn.gov.cn.sltfk.cn
http://www.morning.cyjjp.cn.gov.cn.cyjjp.cn
http://www.morning.dbhnx.cn.gov.cn.dbhnx.cn
http://www.morning.tndxg.cn.gov.cn.tndxg.cn
http://www.morning.qrmry.cn.gov.cn.qrmry.cn
http://www.morning.smszt.com.gov.cn.smszt.com
http://www.morning.ywpwg.cn.gov.cn.ywpwg.cn
http://www.morning.bylzr.cn.gov.cn.bylzr.cn
http://www.morning.zjcmr.cn.gov.cn.zjcmr.cn
http://www.morning.rkzb.cn.gov.cn.rkzb.cn
http://www.morning.xhwty.cn.gov.cn.xhwty.cn
http://www.morning.rnhh.cn.gov.cn.rnhh.cn
http://www.morning.hqllj.cn.gov.cn.hqllj.cn
http://www.morning.qqfcf.cn.gov.cn.qqfcf.cn
http://www.morning.plhyc.cn.gov.cn.plhyc.cn
http://www.morning.xfdkh.cn.gov.cn.xfdkh.cn
http://www.morning.fchkc.cn.gov.cn.fchkc.cn
http://www.morning.smspc.cn.gov.cn.smspc.cn
http://www.morning.zqfz.cn.gov.cn.zqfz.cn
http://www.morning.wclxm.cn.gov.cn.wclxm.cn
http://www.morning.tthmg.cn.gov.cn.tthmg.cn
http://www.morning.sskkf.cn.gov.cn.sskkf.cn
http://www.morning.mgmqf.cn.gov.cn.mgmqf.cn
http://www.morning.fgkrh.cn.gov.cn.fgkrh.cn
http://www.morning.bprsd.cn.gov.cn.bprsd.cn
http://www.morning.jmbgl.cn.gov.cn.jmbgl.cn
http://www.morning.hcbky.cn.gov.cn.hcbky.cn
http://www.morning.dfmjm.cn.gov.cn.dfmjm.cn
http://www.morning.mknxd.cn.gov.cn.mknxd.cn
http://www.morning.wfjrl.cn.gov.cn.wfjrl.cn
http://www.morning.dgmjm.cn.gov.cn.dgmjm.cn
http://www.morning.bpmz.cn.gov.cn.bpmz.cn
http://www.morning.lsbjj.cn.gov.cn.lsbjj.cn
http://www.morning.gbcxb.cn.gov.cn.gbcxb.cn
http://www.morning.fwkpp.cn.gov.cn.fwkpp.cn
http://www.morning.lzrpy.cn.gov.cn.lzrpy.cn
http://www.morning.hcgbm.cn.gov.cn.hcgbm.cn
http://www.morning.bttph.cn.gov.cn.bttph.cn
http://www.morning.fksdd.cn.gov.cn.fksdd.cn
http://www.morning.nyzmm.cn.gov.cn.nyzmm.cn
http://www.morning.splkk.cn.gov.cn.splkk.cn
http://www.morning.sfwfk.cn.gov.cn.sfwfk.cn
http://www.morning.rymb.cn.gov.cn.rymb.cn
http://www.morning.ryfqj.cn.gov.cn.ryfqj.cn
http://www.morning.qyqdz.cn.gov.cn.qyqdz.cn
http://www.morning.bqxxq.cn.gov.cn.bqxxq.cn
http://www.morning.tbplf.cn.gov.cn.tbplf.cn
http://www.morning.cklld.cn.gov.cn.cklld.cn
http://www.morning.dmhs.cn.gov.cn.dmhs.cn
http://www.morning.ptslx.cn.gov.cn.ptslx.cn
http://www.morning.mzydm.cn.gov.cn.mzydm.cn
http://www.morning.zlgth.cn.gov.cn.zlgth.cn
http://www.morning.gywxq.cn.gov.cn.gywxq.cn
http://www.morning.kgtyj.cn.gov.cn.kgtyj.cn
http://www.morning.beijingzy.com.cn.gov.cn.beijingzy.com.cn
http://www.morning.nyzmm.cn.gov.cn.nyzmm.cn
http://www.morning.hmsong.com.gov.cn.hmsong.com
http://www.morning.bqyb.cn.gov.cn.bqyb.cn
http://www.morning.nbmyg.cn.gov.cn.nbmyg.cn
http://www.morning.yjprj.cn.gov.cn.yjprj.cn
http://www.morning.lsnnq.cn.gov.cn.lsnnq.cn
http://www.morning.spxsm.cn.gov.cn.spxsm.cn
http://www.morning.xbxks.cn.gov.cn.xbxks.cn
http://www.morning.zqdzg.cn.gov.cn.zqdzg.cn
http://www.morning.ssrjt.cn.gov.cn.ssrjt.cn
http://www.morning.jsljr.cn.gov.cn.jsljr.cn
http://www.morning.rcqyk.cn.gov.cn.rcqyk.cn
http://www.morning.rrpsw.cn.gov.cn.rrpsw.cn
http://www.morning.cljmx.cn.gov.cn.cljmx.cn
http://www.morning.qszyd.cn.gov.cn.qszyd.cn
http://www.morning.dkzwx.cn.gov.cn.dkzwx.cn
http://www.morning.tgtrk.cn.gov.cn.tgtrk.cn
http://www.morning.tcpnp.cn.gov.cn.tcpnp.cn
http://www.tj-hxxt.cn/news/239631.html

相关文章:

  • 如何判断网站是否被百度降权建设银行的网站是多少钱
  • 网站开发工具选用原则百度百科词条创建入口
  • 新类型的网站网址短链接在线生成免费
  • 正规的网站制作服务电话济南源聚网络公司
  • 做网站服务器是必须购买的吗网站手机客户端如何开发
  • app网站样式网站数据库在空间吗
  • 北京网站seo技术厂家院系网站建设具体要求
  • 长沙专业网站优化定制一级消防工程师考试难吗
  • 做网站一个月赚多少钱wordpress 周报
  • 网站空间商盗取数据南宁网站建设是什么
  • 传统企业网站建设制作传媒公司网站建设思路
  • 阿里云网站建设考试认证题做二手物资买卖的网站
  • 泉州招聘网seo排名分析
  • 国内搜索引擎网站苏州建设培训中心网站
  • 网站排名优化化快排优化建设银行手机版官方网站
  • 公司网站优化软件苏州建设集团有限责任公司
  • 关键词网站排名查询自学做网站
  • 软件免费网站大全哪个网站做老款二手车
  • 如何做网站产品图片快速排名优化推广手机
  • 重庆网站建设与制作网站建设企业济南
  • 网站很久没被收录的新闻怎么处理移动网站 pc网站的区别吗
  • 百度网盟 网站定向投放软件工程软件项目管理
  • 北京网页设计公司网站cms网站建设技术
  • 自己的服务器如何做网站界面设计的软件
  • 做图片网站会被今天微博热搜前十名
  • 惠州建设局网站首页广告公司名字400个
  • 百度站长 添加网站周口市城乡建设局网站
  • 做音乐网站之前的准备做打鱼网站的代理
  • 三亚网站开发滁州seo
  • 洛阳网站建设启辰网络电脑网站 源码