package com.example.androidtest;import android.app.Activity;import android.os.Bundle;import android.view.View;import android.widget.TextView;import android.content.Intent;import android.widget.*;public class TestActivity extends Activity  {private  int i=0;private TextView mytextview; private RadioGroup  genderGropu = null;private RadioButton famalebutton =null;private RadioButton malebutton =null;private CheckBox swimbox =null;private CheckBox runbox =null;private CheckBox readbox =null;private ProgressBar firstBar=null;private ProgressBar secondBar=null;private Button mybutton=null;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.other_activity);mytextview = (TextView)findViewById(R.id.mytextView);firstBar=(ProgressBar)findViewById(R.id.firstbar);secondBar=(ProgressBar)findViewById(R.id.secondbar);mybutton=(Button)findViewById(R.id.mybutton);mybutton.setText(R.string.progress);//mybutton.setOnClickListener(new ButtonListener());/*genderGropu = (RadioGroup)findViewById(R.id.gendergroup);famalebutton= (RadioButton)findViewById(R.id.female);malebutton= (RadioButton)findViewById(R.id.man);swimbox = (CheckBox)findViewById(R.id.swim);runbox =  (CheckBox)findViewById(R.id.run);readbox =  (CheckBox)findViewById(R.id.read);genderGropu.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(){@Overridepublic void onCheckedChanged(RadioGroup group, int checkedId){// TODO Auto-generated method stubif(famalebutton.getId()==checkedId){  System.out.println("female");  Toast.makeText(TestActivity.this,"female被选中",Toast.LENGTH_SHORT).show();}else if (malebutton.getId() ==checkedId){ System.out.println("male被选中"); Toast.makeText(TestActivity.this,"male被选中",Toast.LENGTH_SHORT).show();}}});swimbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton button, boolean ischecked) {// TODO Auto-generated method stubif(ischecked){System.out.println("游泳被选中");Toast.makeText(TestActivity.this,"游泳被选中",Toast.LENGTH_SHORT).show();}else{System.out.println("游泳没有被选中");Toast.makeText(TestActivity.this,"游泳没有被选中",Toast.LENGTH_SHORT).show();}}});runbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton button, boolean ischecked) {// TODO Auto-generated method stubif(ischecked){System.out.println("跑步被选中");Toast.makeText(TestActivity.this,"跑步被选中",Toast.LENGTH_SHORT).show();}else{System.out.println("跑步没有被选中");Toast.makeText(TestActivity.this,"跑步没有被选中",Toast.LENGTH_SHORT).show();}}});readbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {@Overridepublic void onCheckedChanged(CompoundButton button, boolean ischecked) {// TODO Auto-generated method stubif(ischecked){System.out.println("阅读被选中");Toast.makeText(TestActivity.this,"阅读被选中",Toast.LENGTH_SHORT).show();}else{System.out.println("阅读没有被选中");Toast.makeText(TestActivity.this,"阅读没有被选中",Toast.LENGTH_SHORT).show();}}});*///Intent intent =new Intent();//intent = getIntent();//String factorone = intent.getStringExtra("one");//String factortwo = intent.getStringExtra("two");//int factoroneint = Integer.parseInt(factorone);//int factortwoint = Integer.parseInt(factortwo);//int result = factoroneint * factortwoint;//mytextview.setText(result + "");}public void myClick(View target){  if(i == 0) {     firstBar.setVisibility(View.VISIBLE);     secondBar.setVisibility(View.VISIBLE);  }  else if(i<100) { firstBar.setProgress(i); firstBar.setSecondaryProgress(i+10); secondBar.setProgress(i);   }  else { firstBar.setVisibility(View.GONE);     secondBar.setVisibility(View.GONE);   } i=i+10;}}
<pre name="code" class="html"><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="fill_parent"    android:layout_height="fill_parent"    android:orientation="vertical"     android:background="@color/background_color">        <TextView     android:id="@+id/mytextView"     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:text="" />       <!--    <RadioGroup          android:id="@+id/gendergroup"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         >             <RadioButton         android:id="@+id/man"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/male"          />                    <RadioButton         android:id="@+id/female"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/female" />                    </RadioGroup>     <CheckBox        android:id="@+id/swim"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/swim"         />         <CheckBox         android:id="@+id/run"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/run"         />        <CheckBox         android:id="@+id/read"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/read"         />  -->                <ProgressBar          android:id="@+id/firstbar"         style="?android:attr/progressBarStyleHorizontal"         android:layout_width="200dp"         android:layout_height="wrap_content"         android:visibility="gone"                  />     <ProgressBar          android:id="@+id/secondbar"         style="?android:attr/progressBarStyle"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:visibility="gone         />      <Button        android:id="@+id/mybutton"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_below="@+id/Textb"        android:layout_marginTop="68dp"         android:onClick="myClick"          /></LinearLayout>


  


更多相关文章

  1. Android(安卓)Parcelable代码自动生成插件 Parcelable code gene
  2. Android-Module:ToggleButton常用XML属性
  3. 安卓开发_浅谈Android动画(三)
  4. textView写点击选中和没选中效果
  5. ListView的Item中CheckBox焦点优先于ListView的问题
  6. Android(安卓)自定义RadioButton的样式
  7. this version of ADT requires android SDK tools revision 21.0
  8. android 多选联系人
  9. Android(安卓)记住密码和自动登录界面的实现(SharedPreferences

随机推荐

  1. Android中四大组件
  2. 去除Android系统应用的通知功能
  3. android通过USB使用真机调试程序
  4. 一个Google Play的开发者,要了解的一些小
  5. Android(安卓)如何使EditText不自动获取
  6. [Android进阶]Android中使用的观察者模式
  7. Android各种访问权限Permission详解
  8. Android之eclipse简单NDK入门
  9. Android(安卓)开发者的 Flutter(五) —— F
  10. 《论Android的发展方向(个人见解)》