예제 #1
0
        private void InitBottomBar(int size)
        {
            rgBottomBar = FindViewById <RadioGroup>(Resource.Id.bottomBar);
            rgBottomBar.SetOnCheckedChangeListener(this);

            rbExercise = FindViewById <RadioButton>(Resource.Id.rbExercise);
            Drawable drawableExercise = GetDrawable(Resource.Drawable.tab_menu_Exercise);

            drawableExercise.SetBounds(0, 0, DensityUtil.dip2px(this, size), DensityUtil.dip2px(this, size));
            rbExercise.SetCompoundDrawables(null, drawableExercise, null, null);

            rbHealth = FindViewById <RadioButton>(Resource.Id.rbHealth);
            Drawable drawableHealth = GetDrawable(Resource.Drawable.tab_menu_health);

            drawableHealth.SetBounds(0, 0, DensityUtil.dip2px(this, size), DensityUtil.dip2px(this, size));
            rbHealth.SetCompoundDrawables(null, drawableHealth, null, null);

            rbFind = FindViewById <RadioButton>(Resource.Id.rbFind);
            Drawable drawableFind = GetDrawable(Resource.Drawable.tab_menu_find);

            drawableFind.SetBounds(0, 0, DensityUtil.dip2px(this, size), DensityUtil.dip2px(this, size));
            rbFind.SetCompoundDrawables(null, drawableFind, null, null);

            rbMe = FindViewById <RadioButton>(Resource.Id.rbMe);
            Drawable drawableMe = GetDrawable(Resource.Drawable.tab_menu_me);

            drawableMe.SetBounds(0, 0, DensityUtil.dip2px(this, size), DensityUtil.dip2px(this, size));
            rbMe.SetCompoundDrawables(null, drawableMe, null, null);
        }
예제 #2
0
        private void InitView(View parentView)
        {
            rgHealthBar     = (RadioGroup)parentView.FindViewById(Resource.Id.rg_health_bar);
            rbHeartrate     = (RadioButton)parentView.FindViewById(Resource.Id.rb_heartrate);
            rbBloodpressure = (RadioButton)parentView.FindViewById(Resource.Id.rb_bloodpressure);
            rbBloodoxygen   = (RadioButton)parentView.FindViewById(Resource.Id.rb_bloodoxygen);
            rgHealthBar.SetOnCheckedChangeListener(this);

            //        定义图片大小,单位是dx
            int imagesize = 65;
            //        定义rb_heartrate标签图片大小和位置
            Drawable drawable_heartrate = Resources.GetDrawable(Resource.Drawable.tab_health_heartrate, null);

            drawable_heartrate.SetBounds(0, 0, DensityUtil.dip2px(this.Activity, imagesize), DensityUtil.dip2px(this.Activity, imagesize));
            rbHeartrate.SetCompoundDrawables(null, drawable_heartrate, null, null);

            //        定义rb_bloodpressure标签图片大小和位置
            Drawable drawable_bloodpressure = Resources.GetDrawable(Resource.Drawable.tab_health_bloodpressure, null);

            drawable_bloodpressure.SetBounds(0, 0, DensityUtil.dip2px(this.Activity, imagesize), DensityUtil.dip2px(this.Activity, imagesize));
            rbBloodpressure.SetCompoundDrawables(null, drawable_bloodpressure, null, null);

            //        定义rb_bloodoxygen标签图片大小和位置
            Drawable drawable_bloodoxygen = Resources.GetDrawable(Resource.Drawable.tab_health_bloodoxygen, null);

            drawable_bloodoxygen.SetBounds(0, 0, DensityUtil.dip2px(this.Activity, imagesize), DensityUtil.dip2px(this.Activity, imagesize));
            rbBloodoxygen.SetCompoundDrawables(null, drawable_bloodoxygen, null, null);
        }